From f66d4b3a581b2c3dfab8bc06a513ae5d4c2acbcf Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Tue, 10 Jan 2017 21:46:49 +0100 Subject: [PATCH] Put the new Zop handling live for 13x improvement - except for thunky.starts-with('.') ops these are lazy in the fetching of values from the iterators in a way that I haven't fully grokked, so we're using the old code for those cases. This includes: Zand, Z&&, Zor, Z||, Zxor, Z^^ --- src/core/List.pm | 10 +++++----- src/core/metaops.pm | 14 +++++++++++++- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/core/List.pm b/src/core/List.pm index 3a466d82bbc..1061ee2834a 100644 --- a/src/core/List.pm +++ b/src/core/List.pm @@ -1595,14 +1595,14 @@ my &cross := &infix:; proto sub infix:(|) is pure {*} multi sub infix:(+lol, :&with!) { - nqp::if( + Seq.new(nqp::if( nqp::eqaddr(&with,&infix:<,>), - Seq.new(Rakudo::Internals.ZipIterablesIterator(lol)), - Seq.new(Rakudo::Internals.ZipIterablesMapIterator( + Rakudo::Internals.ZipIterablesIterator(lol), + Rakudo::Internals.ZipIterablesMapIterator( lol, Rakudo::Metaops.MapperForOp(&with) - )) - ) + ) + )) } multi sub infix:(+lol) { Seq.new(Rakudo::Internals.ZipIterablesIterator(lol)) diff --git a/src/core/metaops.pm b/src/core/metaops.pm index eaa37831678..a0db64619cb 100644 --- a/src/core/metaops.pm +++ b/src/core/metaops.pm @@ -75,6 +75,7 @@ sub METAOP_CROSS(\op, &reduce) { } sub METAOP_ZIP(\op, &reduce) { + nqp::if(op.prec('thunky').starts-with('.'), -> +lol { my $arity = lol.elems; my $rop = $arity == 2 ?? op !! &reduce(op); @@ -101,8 +102,19 @@ sub METAOP_ZIP(\op, &reduce) { last if $z.elems < $arity; take-rw $arity == 2 ?? $rop(|$z) !! $rop(@$z); } - }.lazy-if($laze); + }.lazy-if($laze) + }, + -> +lol { + Seq.new(nqp::if( + nqp::eqaddr(op,&infix:<,>), + Rakudo::Internals.ZipIterablesIterator(lol), + Rakudo::Internals.ZipIterablesMapIterator( + lol, + Rakudo::Metaops.MapperForOp(op) + ) + )) } + ) } proto sub METAOP_REDUCE_LEFT(|) { * }