Created
September 21, 2010 18:40
-
-
Save anonymous/590253 to your computer and use it in GitHub Desktop.
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
pmichaud@plum:~/parrot/trunk$ cat fib.nqp | |
#! nqp | |
sub fib($n) { | |
$n < 2 ?? $n !! fib($n-1) + fib($n - 2); | |
} | |
my $N := 29; | |
my $t0 := pir::time__N(); | |
my $z := fib($N); | |
my $t1 := pir::time__N(); | |
pir::say("fib($N) = " ~ fib($N)); | |
pir::say("time = " ~ ($t1-$t0)); | |
pmichaud@plum:~/parrot/trunk$ ./parrot-nqp --target=pir fib.nqp >fib.pir | |
pmichaud@plum:~/parrot/trunk$ ./parrot fib.pir | |
fib(29) = 514229 | |
time = 3.43642902374268 | |
pmichaud@plum:~/parrot/trunk$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment