]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Two speedup hacks. Caching the hash saves recalculation of a string's
authorGuido van Rossum <guido@python.org>
Sat, 18 Jan 1997 07:53:23 +0000 (07:53 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 18 Jan 1997 07:53:23 +0000 (07:53 +0000)
commit1e6e9a23688129b5b29fb8e8137f17617d22f483
tree127bb53165c7abbad01669876df73d2ff493471f
parent3dfd53b4c83cc42e694a7c6e66678f2e7b0b1613
Two speedup hacks.  Caching the hash saves recalculation of a string's
hash value.  Interning strings (which requires hash caching) tries to
ensure that only one string object with a given value exists, so
equality tests are one pointer comparison.  Together, these can speed
the interpreter up by as much as 20%.  Each costs the size of a long
or pointer per string object.  In addition, interned strings live
until the end of times.  If you are concerned about memory footprint,
simply comment the #define out here (and rebuild everything!).
Include/stringobject.h