[issue41431] Optimize dict_merge for copy

Inada Naoki report at bugs.python.org
Tue Jul 28 23:10:35 EDT 2020


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

PyDict_Copy() is not used in eval loop or calling functions. So removing clone_combined_dict() is a considerable option.

Another option is to use clone_combined_dict() in dict_merge, instead of adding dict_copy2().

Pros: No performance regression. PyDict_Copy() is as fast as before.
Cons: Can not "fast copy" split dict and dirty dict.

I suppose most dict used by `dict(d)` or `dict.update(d)` is clean and combined. So I will implement the second option.

----------

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


More information about the Python-bugs-list mailing list