diff options
author | Guido van Rossum <guido@python.org> | 2002-08-19 20:24:07 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-08-19 20:24:07 +0000 |
commit | 3a4dfc87e68c8158110145df12109b155eea16e4 (patch) | |
tree | 8388079a1d0dee44bc830ad8b4873ceeb1e12438 /Objects/classobject.c | |
parent | e3a8e7ed1d221e5c19d0b3cd9796b393bc41dc68 (diff) | |
download | cpython-git-3a4dfc87e68c8158110145df12109b155eea16e4.tar.gz |
Another ugly inlining hack, expanding the two PyDict_GetItem() calls
in LOAD_GLOBAL. Besides saving a C function call, it saves checks
whether f_globals and f_builtins are dicts, and extracting and testing
the string object's hash code is done only once. We bail out of the
inlining if the name is not exactly a string, or when its hash is -1;
because of interning, neither should ever happen. I believe interning
guarantees that the hash code is set, and I believe that the 'names'
tuple of a code object always contains interned strings, but I'm not
assuming that -- I'm simply testing hash != -1.
On my home machine, this makes a pystone variant with new-style
classes and slots run at the same speed as classic pystone! (With
new-style classes but without slots, it is still a lot slower.)
Diffstat (limited to 'Objects/classobject.c')
0 files changed, 0 insertions, 0 deletions