Skip to content

Commit

Permalink
Make emit about 30% faster
Browse files Browse the repository at this point in the history
From what I can gather from a --profile.  Before, an "emit/THROW" combo
would take 588 msecs in a benchmark, and after the "emit" by itself takes
442 msecs.  Since this is pretty hot code in Supply handling, thought that
every little bit counts.
  • Loading branch information
lizmat committed Dec 30, 2019
1 parent a3afde6 commit aea2a36
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core.c/control.pm6
Expand Up @@ -159,7 +159,10 @@ sub samewith(|c) {
sub leave(|) { X::NYI.new(feature => 'leave').throw }

sub emit(Mu \value --> Nil) {
THROW(nqp::const::CONTROL_EMIT, nqp::p6recont_ro(value));
my Mu $ex := nqp::newexception();
nqp::setpayload($ex,nqp::p6recont_ro(value));
nqp::setextype($ex,nqp::const::CONTROL_EMIT);
nqp::throw($ex);
}
sub done(--> Nil) {
THROW-NIL(nqp::const::CONTROL_DONE);
Expand Down

0 comments on commit aea2a36

Please sign in to comment.