Created
June 15, 2017 14:01
-
-
Save lizmat/f8978bee4ec54232702d06bddcf50efa to your computer and use it in GitHub Desktop.
potential DYNAMIC speedup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/stubs.pm b/src/core/stubs.pm | |
index 5e58739..5eb0db9 100644 | |
--- a/src/core/stubs.pm | |
+++ b/src/core/stubs.pm | |
@@ -29,25 +29,27 @@ my class Lock is repr('ReentrantMutex') { ... } | |
sub DYNAMIC(\name) is raw { | |
nqp::ifnull( | |
- nqp::getlexdyn(nqp::unbox_s(name)), | |
+ nqp::getlexdyn(name), | |
nqp::stmts( | |
nqp::unless( | |
nqp::isnull(my $prom := nqp::getlexdyn('$*PROMISE')), | |
(my Mu $x := nqp::getlexreldyn( | |
- nqp::getattr($prom,Promise,'$!dynamic_context'),nqp::unbox_s(name)) | |
+ nqp::getattr($prom,Promise,'$!dynamic_context'),name) | |
) | |
), | |
- nqp::if( | |
- nqp::isnull($x), | |
+ nqp::ifnull( | |
+ $x, | |
nqp::stmts( | |
- (my str $pkgname = nqp::replace(nqp::unbox_s(name),1,1,'')), | |
- ($x := nqp::ifnull(nqp::atkey(GLOBAL.WHO,$pkgname), | |
- nqp::ifnull(nqp::atkey(PROCESS.WHO,$pkgname), | |
- Rakudo::Internals.INITIALIZE-DYNAMIC(nqp::unbox_s(name)))) | |
+ (my str $pkgname = nqp::replace(name,1,1,'')), | |
+ nqp::ifnull( | |
+ nqp::atkey(GLOBAL.WHO,$pkgname), | |
+ nqp::ifnull( | |
+ nqp::atkey(PROCESS.WHO,$pkgname), | |
+ Rakudo::Internals.INITIALIZE-DYNAMIC(name) | |
+ ) | |
) | |
) | |
- ), | |
- $x | |
+ ) | |
) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment