[pypy-issue] [issue1414] min()/max() performance

Brian Kearns tracker at bugs.pypy.org
Tue Mar 5 09:59:34 CET 2013

Brian Kearns <bdkearns at gmail.com> added the comment:

Sure, but it's nothing like the factor you talked about. Also, the 'boost' is 
not always positive:

15338900.77 runs/sec, built-in, size = 10, 50000000 runs
7145017.92 runs/sec, with reduce, size = 10, 50000000 runs

2966616.18 runs/sec, built-in, size = 100, 5000000 runs
3396951.23 runs/sec, with reduce, size = 100, 5000000 runs

344860.12 runs/sec, built-in, size = 1000, 500000 runs
563466.53 runs/sec, with reduce, size = 1000, 500000 runs

There may be a remaining optimization to make for min/max, but I'm not even sure 
it is justifiably a bug; we're currently 5-6x CPython for builtin min/max. I'd 
say this is an example of a specific optimization for PyPy useful when calling 
min/max on very long lists (which possibly, though maybe not, could be made 
obsolete with later optimizations in PyPy).

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list