bpo-20180: Use argument clinic for dict.pop() and dict.popitem() by methane · Pull Request #12792 · python/cpython (original) (raw)
Does this provide performance improvement for dict.pop
? I am using a non-PGO build for benchmarking.
➜ cpython git:(master) ./python.exe -m timeit -s 'd = {"a": 1}' 'd.pop("a", None)'
2000000 loops, best of 5: 125 nsec per loop
➜ cpython git:(master) ./python.exe -m timeit -s 'd = {"a": 1}' 'd.pop("a", None)'
2000000 loops, best of 5: 127 nsec per loop
➜ cpython git:(master) ./python.exe -m timeit -s 'd = {"a": 1}' 'd.pop("a", None)'
2000000 loops, best of 5: 127 nsec per loop
➜ cpython git:(pr_12792) ./python.exe -m timeit -s 'd = {"a": 1}' 'd.pop("a", None)'
5000000 loops, best of 5: 82.7 nsec per loop
➜ cpython git:(pr_12792) ./python.exe -m timeit -s 'd = {"a": 1}' 'd.pop("a", None)'
5000000 loops, best of 5: 80.3 nsec per loop
➜ cpython git:(pr_12792) ./python.exe -m timeit -s 'd = {"a": 1}' 'd.pop("a", None)'
5000000 loops, best of 5: 74.5 nsec per loop