Skip to content
Permalink
Browse files

Final stab at making >>op=<< faster

- just attach a name to the op + a tag, and check for that
- makes @A >>+=>> 1 more than 2x as fast
- please note that @A := @A >>+>> 1 is still 1.5x faster
  - on account of not having to do 2 frames for each op
  • Loading branch information...
lizmat committed Nov 17, 2018
1 parent 86ce4f4 commit 50f2207bb99ad639108edf00f669142d2a679303
Showing with 4 additions and 2 deletions.
  1. +1 −1 src/core/Hyper.pm6
  2. +3 −1 src/core/metaops.pm6
@@ -11,7 +11,7 @@ class Hyper {
:operator(op),
:$dwim-left,
:$dwim-right,
:assigns(op.name.ends-with("=>")),
:assigns(op.name.ends-with(' + {assigning}')),
)
}

@@ -1,6 +1,8 @@

sub METAOP_ASSIGN(\op) {
-> Mu \a, Mu \b { a = op.( ( a.DEFINITE ?? a !! op.() ), b) } #= METAOP_ASSIGN
my \op-is := -> Mu \a, Mu \b { a = op.( ( a.DEFINITE ?? a !! op.() ), b) }
op-is.set_name(op.name ~ ' + {assigning}'); # checked for in Hyper.new
op-is
}

sub METAOP_TEST_ASSIGN:<//>(\lhs, $rhs) is raw { lhs // (lhs = $rhs()) }

0 comments on commit 50f2207

Please sign in to comment.
You can’t perform that action at this time.