[issue30040] new empty dict can be more small

Inada Naoki report at bugs.python.org
Tue Mar 12 13:10:25 EDT 2019


Inada Naoki <songofacandy at gmail.com> added the comment:

Another micro benchmark:

$ ./py.edict.opt -m perf timeit --compare-to ./py.master.opt '{}' --duplicate=10
py.master.opt: ..................... 26.3 ns +- 0.5 ns
py.edict.opt: ..................... 13.0 ns +- 0.1 ns

Mean +- std dev: [py.master.opt] 26.3 ns +- 0.5 ns -> [py.edict.opt] 13.0 ns +- 0.1 ns: 2.02x faster (-51%)

$ ./py.edict.opt -m perf timeit --compare-to ./py.master.opt 'd={}; d["a"]=None' --duplicate=10
py.master.opt: ..................... 58.1 ns +- 0.9 ns
py.edict.opt: ..................... 64.1 ns +- 0.9 ns

Mean +- std dev: [py.master.opt] 58.1 ns +- 0.9 ns -> [py.edict.opt] 64.1 ns +- 0.9 ns: 1.10x slower (+10%)


Hmm, while 2x faster temporal empty dict is nice, 10% slower case can be mitigated.
I will try more micro benchmarks and optimizations.

----------

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


More information about the Python-bugs-list mailing list