Message40899
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.
|
|
Date |
User |
Action |
Args |
2007-08-23 15:14:40 | admin | link | issue593627 messages |
2007-08-23 15:14:40 | admin | create | |
|