[Python-Dev] Interning string subtype instances (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Feb 15 02:35:49 CET 2007
- Previous message: [Python-Dev] Interning string subtype instances
- Next message: [Python-Dev] Interning string subtype instances
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Josiah Carlson wrote:
Assuming that dictionaries and the hash algorithm for strings is not hopelessly broken, I believe that one discovers quite quickly when two strings are not equal.
You're probably right, since if there's a hash collision, the colliding strings probably differ in the first char or two.
Interning will speed up the case where they are equal, where otherwise you would have to examine every character.
Still, there could be extension modules out there somewhere that make use of PyString_CHECK_INTERNED, so there's a slight chance that home-grown interning might not give the same results in all cases.
-- Greg
- Previous message: [Python-Dev] Interning string subtype instances
- Next message: [Python-Dev] Interning string subtype instances
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]