Skip to content

Instantly share code, notes, and snippets.

@jnthn

jnthn/head.raku Secret

Created April 14, 2021 16:58
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/088f8e3de021460cccef5f857d5db9d4 to your computer and use it in GitHub Desktop.
Save jnthn/088f8e3de021460cccef5f857d5db9d4 to your computer and use it in GitHub Desktop.
multi fac($n where $n <= 1) { 1 }
multi fac($n) { $n * fac($n - 1) }
for ^100_000 {
fac(10)
}
say now - INIT now;
use nqp;
multi fac($n where $n <= 1) { 1 }
multi fac($n) { $n * nqp::dispatch('raku-call', &fac, $n - 1) }
for ^100_000 {
nqp::dispatch('raku-call', &fac, 10);
}
say now - INIT now;
jnthn@homedev:~/dev/rakudo$ ./rakudo-m where-head.raku
4.859758291
jnthn@homedev:~/dev/rakudo$ RAKUDO_NEW_DISP=1 ./rakudo-m where-new-disp.raku
1.337807436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment