(original) (raw)

Hi, this is my first python dev post, so please forgive me if this topic has already been discussed.

It seemed to me that removing me_hash from a dict entry would save 2/3 of the space used by dictionaries and also improve alignment of the entries since they'd be 8 bytes instead of 12. And sets end up having just 4 byte entries.


I'm guessing that string dicts are the most common (hence the specialized lookupdict_string routine), and since strings already contain their hash, this would probably mitigate the performance impact. One could also add a hash to Tuples since they are immutable.


If this isn't a totally stupid idea, I'd be happy to volunteer to try the experiment and run any suggested tests.

thanks!
-Kirat

PS any opinion on making _Py_StringEq a macro? inline function would be nice but I hesitate to bring up the C/C++ debate, both languages suck in their own special way ;-)