Created
October 3, 2011 16:56
-
-
Save benjaminoakes/1259589 to your computer and use it in GitHub Desktop.
EMScripten performance
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
def fib(i) | |
if i == 0 || i == 1 | |
1 | |
else | |
fib(i - 2) + fib(i - 1) | |
end | |
end | |
start = Time.now | |
puts fib(20) | |
stop = Time.now | |
diff = stop - start | |
puts diff | |
# http://repl.it | |
# | |
# Ruby 1.8.7 (2008-05-31 patchlevel 0) [x86-linux] | |
# [GCC 4.2.1 (LLVM, Emscripten 1.5, Emscripted-Ruby)] | |
# 10946 | |
# 4.121 | |
# Native OS X Ruby | |
# | |
# ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0] | |
# 10946 | |
# 0.010449 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment