Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 15 lines (10 sloc) 0.224 kB
f59925c @pmichaud Add fib.nqp as a recursion benchmark example.
pmichaud authored
1 #! nqp
2
3 sub fib($n) {
4 $n < 2 ?? $n !! fib($n-1) + fib($n - 2);
5 }
6
7 my $N := 29;
8
881c8d1 @kboga pir::time__N to nqp::time_n
kboga authored
9 my $t0 := nqp::time_n();
f59925c @pmichaud Add fib.nqp as a recursion benchmark example.
pmichaud authored
10 my $z := fib($N);
881c8d1 @kboga pir::time__N to nqp::time_n
kboga authored
11 my $t1 := nqp::time_n();
f59925c @pmichaud Add fib.nqp as a recursion benchmark example.
pmichaud authored
12
4702e8a @kboga pir::chr to nqp::chr and pir::print to nqp::print and pir::say to nqp…
kboga authored
13 nqp::say("fib($N) = " ~ fib($N));
14 nqp::say("time = " ~ ($t1-$t0));
Something went wrong with that request. Please try again.