Skip to content

Instantly share code, notes, and snippets.

@evanphx
Created December 19, 2008 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanphx/38169 to your computer and use it in GitHub Desktop.
Save evanphx/38169 to your computer and use it in GitHub Desktop.
require 'benchmark'
cm = def blah
i = 0
while i < 10
j = 0
while j < 20000000
j += 1
end
i += 1
end
end
=begin
cm = def fib n
if n < 3
1
else
fib(n-1) + fib(n-2)
end
end
=end
p cm
puts Benchmark.measure {
blah()
}
if ARGV.shift == "rbx"
mm = cm.make_machine_method
p mm
mm.disassemble
mm.activate
end
puts Benchmark.measure {
p blah()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment