• Guido van Rossum's avatar
    Two speedup hacks. Caching the hash saves recalculation of a string's · 1e6e9a23
    Guido van Rossum yazdı
    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!).
    1e6e9a23
stringobject.h 4.06 KB