Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created February 5, 2021 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jnthn/1bf4fda2eaea2d6b8b3a4ed5d89c4deb to your computer and use it in GitHub Desktop.
Save jnthn/1bf4fda2eaea2d6b8b3a4ed5d89c4deb to your computer and use it in GitHub Desktop.
use nqp;
sub with-current-disp() {
sub inner() { 'i' }
&inner.wrap({ 'w1' ~ callsame() });
&inner.wrap({ 'w2' ~ callsame() });
for ^1_000_000 {
inner();
}
say "Current: " ~ now - ENTER now;
}
sub with-new-disp() {
sub inner() { 'i' }
&inner.new-disp-wrap({ 'w1' ~ new-disp-callsame() });
&inner.new-disp-wrap({ 'w2' ~ new-disp-callsame() });
for ^1_000_000 {
nqp::dispatch('raku-invoke', &inner);
}
say "New: " ~ now - ENTER now;
}
with-current-disp();
with-new-disp();
Current: 34.965479
New: 3.997993965
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment