[issue30040] new empty dict can be more small

INADA Naoki report at bugs.python.org
Tue Apr 11 05:42:45 EDT 2017


INADA Naoki added the comment:

performance impact

best case:
$ ./python.patched -m perf timeit --compare-to=`pwd`/python.default  -- '{}'
python.default: ..................... 36.9 ns +- 0.9 ns
python.patched: ..................... 25.3 ns +- 0.7 ns
Mean +- std dev: [python.default] 36.9 ns +- 0.9 ns -> [python.patched] 25.3 ns +- 0.7 ns: 1.46x faster (-31%)

worst case:
$ ./python.patched -m perf timeit --compare-to=`pwd`/python.default  -- 'x={}; x["a"]=1'
python.default: ..................... 73.3 ns +- 1.2 ns
python.patched: ..................... 82.8 ns +- 1.8 ns
Mean +- std dev: [python.default] 73.3 ns +- 1.2 ns -> [python.patched] 82.8 ns +- 1.8 ns: 1.13x slower (+13%)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30040>
_______________________________________


More information about the Python-bugs-list mailing list