Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmarks #36

Open
dcutting opened this issue Feb 22, 2018 · 0 comments
Open

Benchmarks #36

dcutting opened this issue Feb 22, 2018 · 0 comments

Comments

@dcutting
Copy link
Owner

Current benchmark for calculating the 80th Fibonacci number 1000 times:

n.fib = n.fib(0, n)
0.fib(a, _) = a
n.fib(a, b) = (n-1).fib(b, a+b)

0.times(_, r) = r
x.times(f, _) = (x-1).times(f, f(1))
x.times(f) = x.times(f, 0)

999.times(|_| 80.fib)
out(80.fib)
1873338267877414800

real	0m3.147s
user	0m3.124s
sys	0m0.015s

For comparison, Ruby is:

real	0m0.809s
user	0m0.453s
sys	0m0.294s

And compiled Swift is:

real	0m0.016s
user	0m0.007s
sys	0m0.005s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant