This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xiang.zhang
Recipients methane, rhettinger, serhiy.storchaka, vstinner, xiang.zhang
Date 2016-10-28.13:13:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1477660411.61.0.0433256717609.issue28199@psf.upfronthosting.co.za>
In-reply-to
Content
I doubt how many memcpy could benefit. Two pass does not necessarily make faster. I make a simple test:

With dictresize3, (I make insert_index inline):

[bin]$ ./python3 -m perf timeit -s 'd = {i:i for i in range(6)}' 'dict(d)'
....................
Median +- std dev: 441 ns +- 21 ns
[bin]$ ./python3 -m perf timeit -s 'd = {i:i for i in range(60)}' 'dict(d)'
....................
Median +- std dev: 2.02 us +- 0.10 us
[bin]$ ./python3 -m perf timeit -s 'd = {i:i for i in range(600)}' 'dict(d)'
....................
Median +- std dev: 18.1 us +- 0.9 us

With dictresize4:

[bin]$ ./python3 -m perf timeit -s 'd = {i:i for i in range(6)}' 'dict(d)'
....................
Median +- std dev: 448 ns +- 33 ns
[bin]$ ./python3 -m perf timeit -s 'd = {i:i for i in range(60)}' 'dict(d)'
....................
Median +- std dev: 2.04 us +- 0.09 us
[bin]$ ./python3 -m perf timeit -s 'd = {i:i for i in range(600)}' 'dict(d)'
....................
Median +- std dev: 18.2 us +- 0.1 us

Just like INAKA states, there is hardly any difference. And you need 2 pass for dicts with deleted member.
History
Date User Action Args
2016-10-28 13:13:31xiang.zhangsetrecipients: + xiang.zhang, rhettinger, vstinner, methane, serhiy.storchaka
2016-10-28 13:13:31xiang.zhangsetmessageid: <1477660411.61.0.0433256717609.issue28199@psf.upfronthosting.co.za>
2016-10-28 13:13:31xiang.zhanglinkissue28199 messages
2016-10-28 13:13:31xiang.zhangcreate