Skip to content

Instantly share code, notes, and snippets.

@benjaminoakes
Created October 3, 2011 16:56
Show Gist options
  • Save benjaminoakes/1259589 to your computer and use it in GitHub Desktop.
Save benjaminoakes/1259589 to your computer and use it in GitHub Desktop.
EMScripten performance
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