[issue26058] Add dict.__version__ read-only property
STINNER Victor
report at bugs.python.org
Sat Jan 9 04:53:06 EST 2016
STINNER Victor added the comment:
Using timeit to microbenchmark dict operations (constructor, __setitem__, __delitem__, clear), I get exactly the same performance or even better performance (???) with the patch.
./python -m timeit 'd={1: 0}; d[2]=0; d[3]=0; d[4]=0; del d[1]; del d[2]; d.clear()'
Original: 318 ns
Patched: 318 ns
./python -m timeit 'd={i:i for i in range(2**16)}' 'for i in range(2**16): d[i]=i-1' 'for i in range(2**16): d[i]=i+1' 'for i in range(2**15): del d[i]' 'd.clear()'
Original: 19.9 ms
Patched: 18.9 ms (5% faster)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26058>
_______________________________________
More information about the Python-bugs-list
mailing list