[Python-Dev] More compact dictionaries with faster iteration

Serhiy Storchaka storchaka at gmail.com
Tue Dec 11 12:12:10 CET 2012


Yet some comments about your Python implementation.

1. Don't use "is FREE" and "is DUMMY" as array doesn't preserve identity.

2. Wrong limits used in _make_index(): 128 overflows 'b', 65536 
overflows 'h' and 'l' can be not enough for ssize_t.

3. round_upto_powtwo() can be implemented as 1 << n.bit_length().

4. i * 5 faster than (i << 2) + i on Python.

5. You can get rid of "size" attribute and use len(self.keylist) instead.




More information about the Python-Dev mailing list