[issue41431] Optimize dict_merge for copy

2020-08-03 Thread Inada Naoki
Change by Inada Naoki : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed type: -> performance ___ Python tracker ___

[issue41431] Optimize dict_merge for copy

2020-08-03 Thread Inada Naoki
Inada Naoki added the comment: New changeset db6d9a50cee92c0ded7c5cb87331c5f0b1008698 by Inada Naoki in branch 'master': bpo-41431: Optimize dict_merge for copy (GH-21674) https://github.com/python/cpython/commit/db6d9a50cee92c0ded7c5cb87331c5f0b1008698 --

[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +serhiy.storchaka, yselivanov ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Inada Naoki
Change by Inada Naoki : -- pull_requests: +20819 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21674 ___ Python tracker ___

[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Inada Naoki
Inada Naoki 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.

[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Inada Naoki
Inada Naoki added the comment: To reduce code size, I am considering to remove clone_combined_dict. I will check how PyDict_Copy() is performance critical. This is microbenchmark result of d.copy() and dict(d). $ ./python -m pyperf timeit --compare-to ./python-master -s

[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Inada Naoki
Inada Naoki added the comment: Microbenchmark for commit cf4f61ce50e07f7ccd3aef991647050c8da058f9. # timeit -s 'd=dict.fromkeys(range(8))' -- 'dict(d)' Mean +- std dev: [master] 311 ns +- 2 ns -> [patched] 144 ns +- 1 ns: 2.16x faster (-54%) # timeit -s 'd=dict.fromkeys(range(1000))' --

[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Inada Naoki
Change by Inada Naoki : -- keywords: +patch pull_requests: +20813 stage: -> patch review pull_request: https://github.com/python/cpython/pull/21669 ___ Python tracker ___

[issue41431] Optimize dict_merge for copy

2020-07-28 Thread Inada Naoki
New submission from Inada Naoki : Although there are dict.copy() and PyDict_Copy(), dict_merge can be used for copying dict. * d={}; d.update(orig) * d=dict(orig) * d=orig.copy() # orig has many dummy keys. -- components: Interpreter Core messages: 374550 nosy: inada.naoki priority: