Message277287
| Author |
serhiy.storchaka |
| Recipients |
Demur Rumed, abarry, rhettinger, serhiy.storchaka, vstinner |
| Date |
2016年09月23日.16:58:57 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1474649937.31.0.441613884084.issue27358@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Yes, it is expected perf regression compared to Python 3.5 and 2.7 when pass keyword arguments and single var-keyword argument (because 3.6 uses BUILD_MAP_UNPACK_WITH_CALL, while 2.7 and 3.5 don't need it for this case). In case of multiple var-keyword arguments (all versions need BUILD_MAP_UNPACK_WITH_CALL) even unpatched 3.6 is faster than 3.5.
$ ./python -m timeit -s "def f(**kw): pass" -s "b = {'b': 2}" -- "f(a=1, **b)"
Python 2.7: 100000 loops, best of 3: 2.21 usec per loop
Python 3.5: 100000 loops, best of 3: 4.31 usec per loop
Python 3.6 unpatched: 100000 loops, best of 3: 7.64 usec per loop
Python 3.6 patched: 100000 loops, best of 3: 3.14 usec per loop
$ ./python -m timeit -s "def f(**kw): pass" -s "a = {'a': 1}; b = {'b': 2}" -- "f(**a, **b)"
Python 3.5: 100000 loops, best of 3: 11.6 usec per loop
Python 3.6 unpatched: 100000 loops, best of 3: 6.93 usec per loop
Python 3.6 patched: 100000 loops, best of 3: 2.66 usec per loop
$ ./python -m timeit -s "def f(a=None, b=None): pass" -s "b = {'b': 2}" -- "f(a=1, **b)"
Python 2.7: 100000 loops, best of 3: 1.97 usec per loop
Python 3.5: 100000 loops, best of 3: 3.75 usec per loop
Python 3.6 unpatched: 100000 loops, best of 3: 7.27 usec per loop
Python 3.6 patched: 100000 loops, best of 3: 2.83 usec per loop
$ ./python -m timeit -s "def f(a=None, b=None): pass" -s "a = {'a': 1}; b = {'b': 2}" -- "f(**a, **b)"
Python 3.5: 100000 loops, best of 3: 10.6 usec per loop
Python 3.6 unpatched: 100000 loops, best of 3: 6.47 usec per loop
Python 3.6 patched: 100000 loops, best of 3: 2.31 usec per loop |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年09月23日 16:58:57 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, vstinner, abarry, Demur Rumed |
| 2016年09月23日 16:58:57 | serhiy.storchaka | set | messageid: <1474649937.31.0.441613884084.issue27358@psf.upfronthosting.co.za> |
| 2016年09月23日 16:58:57 | serhiy.storchaka | link | issue27358 messages |
| 2016年09月23日 16:58:57 | serhiy.storchaka | create |
|