Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35582>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to