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

Reply via email to