Message351315
> This change produces tiny, but measurable speed-up for handling small ints
I didn't get measurable change, I run this command a dozen times and take the best result:
D:\dev\cpython\PCbuild\amd64\python.exe -m pyperf timeit -s "from collections import deque; consume = deque(maxlen=0).extend; r = range(256)" "consume(r)" --duplicate=1000
before: Mean +- std dev: 771 ns +- 16 ns
after: Mean +- std dev: 770 ns +- 10 ns
Environment:
64-bit release build by MSVC 2017
CPU: i3 4160, System: latest Windows 10 64-bit
Check the machine code from godbolt.org, x64 MSVC v19.14 only saves one instruction:
movsxd rax, ecx
x86-64 GCC 9.2 saves two instructions:
lea eax, [rdi+5]
cdqe |
|
Date |
User |
Action |
Args |
2019-09-08 05:53:17 | malin | set | recipients:
+ malin, rhettinger, mark.dickinson, Greg Price, sir-sigurd, aeros |
2019-09-08 05:53:17 | malin | set | messageid: <1567921997.4.0.851324833966.issue38015@roundup.psfhosted.org> |
2019-09-08 05:53:17 | malin | link | issue38015 messages |
2019-09-08 05:53:17 | malin | create | |
|