On Tue, Aug 3, 2010 at 1:18 AM, Aaron Sherman <a...@ajs.com> wrote:

> I know that Rakudo isn't well tuned for performance right now, but this is
> still probably worth noting because it's such a specific difference between
> two similar ways of doing one task.
>
> The recent thread about "..." and ".." had me doing some testing and I
> noticed that ".." seems to be radically faster at loop iteration.


Perhaps, as an optimization, we could create another multi for infix:<...>
that fires to infix:<..> only when the list on either side only contains 1
element and that element is an Int.  Something like:

our multi sub infix:<...>($lhs where Int, $rhs where Int) {
    $lhs .. $rhs
}

caveat lector, this is off the top of my head before sufficient caffienation
 :)

-Scott


> For
> example:
>
> $ time ./perl6 -e 'for 1...1000 -> $i { 1; }; say "Done"'
> Done
>
> real    0m6.688s
> user    0m6.400s
> sys     0m0.290s
>
> $ time ./perl6 -e 'for 1..1000 -> $i { 1; }; say "Done"'
> Done
>
> real    0m2.114s
> user    0m1.870s
> sys     0m0.200s
>
> --
> Aaron Sherman
> Email or GTalk: a...@ajs.com
> http://www.ajs.com/~ajs
>

Reply via email to