Re: [pypy-dev] [pypy-svn] r77101 - in pypy/trunk/pypy: jit/tl module/__builtin__ module/__builtin__/test module/pypyjit/test
Hi, Can you maybe make a branch, and move the checkin on the branch? That's the kind of change that needs careful consideration... Armin ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] [pypy-svn] r77101 - in pypy/trunk/pypy: jit/tl module/__builtin__ module/__builtin__/test module/pypyjit/test
2010 at 9:03 AM, Antonio Cuni wrote: >> + >> + args_w = args.arguments_w >> + if len(args_w)> 1 and not args.keywords: # Unrollable case >> + w_max_item = None >> + for w_item in args_w: >> + if w_max_item is None or \ >> + space.is_true(compare(w_item, w_max_item)): >> + w_max_item = w_item >> + return w_max_item >> + else: >> + return min_max_loop(space, args, implementation_of) > > > I don't think it's a good idea. What happens if I call max() over a list of 1 > million of elements? We obviously don't want the jit to unroll 1 million of > iterations. Or am I missing something? If lst is your list, the call max(lst) has a single argument, the list, and it will be passed to the old implementation now called min_max_loop. However if you call max(*lst) the jit will unroll it. But why would you do that? The idea here was to optimize the case max(i,0) where you typically only have a few arguments. Anyway, how about calling min_max_loop() as soon as len(args_w) > 10 to be on the safe side? -- Håkan Ardö ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev
Re: [pypy-dev] [pypy-svn] r77101 - in pypy/trunk/pypy: jit/tl module/__builtin__ module/__builtin__/test module/pypyjit/test
Hi, On 16/09/10 07:27, hakana...@codespeak.net wrote: > Log: > Allow jit to unroll calls to max() and min() with more than one argument. > [cut] > +...@unroll_safe > @specialize.arg(2) > def min_max(space, args, implementation_of): > if implementation_of == "max": > compare = space.gt > else: > compare = space.lt > + > +args_w = args.arguments_w > +if len(args_w)> 1 and not args.keywords: # Unrollable case > +w_max_item = None > +for w_item in args_w: > +if w_max_item is None or \ > + space.is_true(compare(w_item, w_max_item)): > +w_max_item = w_item > +return w_max_item > +else: > +return min_max_loop(space, args, implementation_of) I don't think it's a good idea. What happens if I call max() over a list of 1 million of elements? We obviously don't want the jit to unroll 1 million of iterations. Or am I missing something? ciao, Anto ___ pypy-dev@codespeak.net http://codespeak.net/mailman/listinfo/pypy-dev