Message333487
PR 11524 performs the same kind of changes as PR 11520, but for handwritten code (only if this causes noticeable speed up). Also iter() is now use the fast call convention.
$ ./python -m timeit "iter(())"
Unpatched: 5000000 loops, best of 5: 82.8 nsec per loop
Patched: 5000000 loops, best of 5: 56.3 nsec per loop
$ ./python -m timeit -s "it = iter([])" "next(it, None)"
Unpatched: 5000000 loops, best of 5: 54.1 nsec per loop
Patched: 5000000 loops, best of 5: 44.9 nsec per loop
$ ./python -m timeit "getattr(1, 'numerator')"
Unpatched: 5000000 loops, best of 5: 63.6 nsec per loop
Patched: 5000000 loops, best of 5: 57.5 nsec per loop
$ ./python -m timeit -s "from operator import attrgetter; f = attrgetter('numerator')" "f(1)"
Unpatched: 5000000 loops, best of 5: 64.1 nsec per loop
Patched: 5000000 loops, best of 5: 56.8 nsec per loop
$ ./python -m timeit -s "from operator import methodcaller; f = methodcaller('conjugate')" "f(1)"
Unpatched: 5000000 loops, best of 5: 79.5 nsec per loop
Patched: 5000000 loops, best of 5: 74.1 nsec per loop
It is possible to speed up also many math methods and maybe some contextvar and hamt methods, but this is for other issues. |
|
Date |
User |
Action |
Args |
2019-01-11 17:09:40 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, scoder, vstinner, larry, xtreak |
2019-01-11 17:09:39 | serhiy.storchaka | set | messageid: <1547226579.06.0.836314325498.issue35582@roundup.psfhosted.org> |
2019-01-11 17:09:39 | serhiy.storchaka | link | issue35582 messages |
2019-01-11 17:09:39 | serhiy.storchaka | create | |
|