[issue32623] Resize dict on del/pop

INADA Naoki report at bugs.python.org
Wed Jan 24 11:02:09 EST 2018


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

> * When dict size become 0, make the dict shared-empty, like dict.clear()

This will cause significant performance regression for `dict[a]=None; del dict[a]` loop.
del/pop shouldn't do clear().

> * When (dict size < dk_size/8), call insertion_resize()

This is bad too.
When ma_used=127 and dk_size=1024, new size will be 1024!
It's because current GROWTH_RATE is used*2 + size/2.

This GROWTH_RATE is set in issue17563.
We should understand it before changing anything.

----------

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


More information about the Python-bugs-list mailing list