summaryrefslogtreecommitdiff
path: root/Objects/classobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-08-19 20:24:07 +0000
committerGuido van Rossum <guido@python.org>2002-08-19 20:24:07 +0000
commit3a4dfc87e68c8158110145df12109b155eea16e4 (patch)
tree8388079a1d0dee44bc830ad8b4873ceeb1e12438 /Objects/classobject.c
parente3a8e7ed1d221e5c19d0b3cd9796b393bc41dc68 (diff)
downloadcpython-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