Skip to content

Commit

Permalink
Make take foo about 20% faster
Browse files Browse the repository at this point in the history
By not using the helper THROW sub, but instead do all of the stuff
inside `take`.
  • Loading branch information
lizmat committed Dec 30, 2019
1 parent aea2a36 commit a91813d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core.c/control.pm6
Expand Up @@ -59,8 +59,12 @@ multi sub take-rw(|) {

proto sub take(|) {*}
multi sub take() { die "take without parameters doesn't make sense" }
multi sub take(\x) {
THROW(nqp::const::CONTROL_TAKE, nqp::p6recont_ro(x))
multi sub take(\value) {
my Mu $ex := nqp::newexception();
nqp::setpayload($ex,nqp::p6recont_ro(value));
nqp::setextype($ex,nqp::const::CONTROL_TAKE);
nqp::throw($ex);
value
}
multi sub take(|) {
THROW(
Expand Down

0 comments on commit a91813d

Please sign in to comment.