[Python-Dev] Keeping interned strings in a set (original) (raw)
Alexander Belopolsky alexander.belopolsky at gmail.com
Thu Jun 15 23:13:08 CEST 2006
- Previous message: [Python-Dev] About dynamic module loading
- Next message: [Python-Dev] Keeping interned strings in a set
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
As an exercise in using the new set C API, I've replaced the "interned" dictionary in stringobject.c with a set. Surprisingly, what I thought would be a simple exercise, took several hours to implement and debug. Two problems are worth mentioning:
I had to add a function to setobject.h to retrieve a pointer to an object stored in a set. I could not find a way to do it using current API (short of iterating through the set of course).
I had to change the PyString_Fini() and PySet_Fini() in Py_Finalize() because cleaning "interned" set cannot be done after the set module is finalized.
If there is any interest, I will submit a patch, but it does not seem to affect performance in any meaningful way.
- Previous message: [Python-Dev] About dynamic module loading
- Next message: [Python-Dev] Keeping interned strings in a set
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]