This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author orenti
Recipients
Date 2002-08-11.10:41:22
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
This patch creates static string objects for all built-in 
names and interns then on initialization. The macro 
PyNAME is be used to access static names.

PyNAME(__spam__) is equivalent to 
PyString_InternFromString("__spam__") but is a 
constant expression. It requires the name to be one of 
the built-in names. A linker error will be generated if it 
isn't.

Most conversions of C strings into temporary string 
objects can be eliminated (PyString_FromString, 
PyString_InternFromString). Most string comparisons at 
runtime can also be eliminated. 

Instead of :
if (strcmp(PyString_AsString(name), "__spam__")) ...

This code can be used:
PyString_INTERN(name)
if (name == PyNAME(__spam__)) ...

Where PyString_INTERN is a fast inline check if the 
string is already interned (and it usually is). To prevent 
unbounded accumulation of interned strings the mortal 
interned string patch should also be applied.

The patch converts most of the builtin module to this 
new mode as an example.
History
Date User Action Args
2007-08-23 15:14:40adminlinkissue593627 messages
2007-08-23 15:14:40admincreate