[issue21988] Decrease iterating overhead in timeit

Alex Gaynor report at bugs.python.org
Wed Jul 16 16:39:31 CEST 2014


Alex Gaynor added the comment:

I think this is likely to make timeit less representative of how code actually performs in the real world on systems with a JIT. This is because of the cost of sequential operations is not strictly "additive" on PyPy.

If you have statements `a` and `b`, and you run `a; b` on PyPy, the performance of `a; b` is usually faster than the sum of `a`, `b`, assuming they are not 100% independent.

This is because the JIT will be able to remove type checks that were already performed. Since this just repeats the same statement, the cost of the unrolled iterations beyond the first will be massively lower in many cases, producing confusing results.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21988>
_______________________________________


More information about the Python-bugs-list mailing list