Author malin
Recipients Greg Price, aeros, malin, mark.dickinson, rhettinger, sir-sigurd
Date 2019-09-08.05:53:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 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

    64-bit release build by MSVC 2017
    CPU: i3 4160, System: latest Windows 10 64-bit

Check the machine code from, x64 MSVC v19.14 only saves one instruction:
    movsxd  rax, ecx

x86-64 GCC 9.2 saves two instructions:
    lea     eax, [rdi+5]
Date User Action Args
2019-09-08 05:53:17malinsetrecipients: + malin, rhettinger, mark.dickinson, Greg Price, sir-sigurd, aeros
2019-09-08 05:53:17malinsetmessageid: <>
2019-09-08 05:53:17malinlinkissue38015 messages
2019-09-08 05:53:17malincreate