Message354479
Thanks, Pablo, for providing that. So the changes look like mostly a wash on these benchmarks.
Serhiy:
I do not see any significant change in + operator timing on my machine (again, just a rough test):
$ ./python.exe -m timeit -s z=0 z+0 # master
10000000 loops, best of 5: 21.3 nsec per loop
$ ./python.exe -m timeit -s z=0 z+0 # list-add
10000000 loops, best of 5: 21.2 nsec per loop
I'm aware that unpacking is "better". With that said, adding a list literal (or a slice of any list, or a list comprehension) to another list is a fairly common operation (I count several dozen examples in the stdlib). Even though these cases only have two operands, they will still see the speed-up.
And the speed-up is good, even in these cases. You can compare using the new code:
$ ./python.exe -m timeit -s l=[0,1,2,3] [0,1,2,3]+l # Hits new branch
5000000 loops, best of 5: 87.9 nsec per loop
$ ./python.exe -m timeit -s l=[0,1,2,3] l+[0,1,2,3] # Hits old branch
5000000 loops, best of 5: 92.5 nsec per loop |
|
Date |
User |
Action |
Args |
2019-10-11 18:20:35 | brandtbucher | set | recipients:
+ brandtbucher, serhiy.storchaka, pablogsal |
2019-10-11 18:20:35 | brandtbucher | set | messageid: <1570818035.53.0.99455845507.issue38436@roundup.psfhosted.org> |
2019-10-11 18:20:35 | brandtbucher | link | issue38436 messages |
2019-10-11 18:20:35 | brandtbucher | create | |
|