Author: Armin Rigo <[email protected]>
Branch:
Changeset: r94988:dc18c3e11193
Date: 2018-08-09 22:37 +0200
http://bitbucket.org/pypy/pypy/changeset/dc18c3e11193/
Log: Issue #2839
max(list-of-int) was much slower when run from non-jitted code.
Fixed.
diff --git a/pypy/module/__builtin__/functional.py
b/pypy/module/__builtin__/functional.py
--- a/pypy/module/__builtin__/functional.py
+++ b/pypy/module/__builtin__/functional.py
@@ -209,8 +209,12 @@
@specialize.arg(2)
def min_max(space, args, implementation_of):
- if not jit.we_are_jitted() or len(args.arguments_w) != 1 and \
- jit.loop_unrolling_heuristic(args.arguments_w,
len(args.arguments_w)):
+ # the 'normal' version includes a JIT merge point, which will make a
+ # new loop (from the interpreter or from another JIT loop). If we
+ # give exactly two arguments to the call to max(), or a JIT virtual
+ # list of arguments, then we pick the 'unroll' version with no JIT
+ # merge point.
+ if jit.isvirtual(args.arguments_w) or len(args.arguments_w) == 2:
return min_max_unroll(space, args, implementation_of)
else:
return min_max_normal(space, args, implementation_of)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit