Skip to content

Instantly share code, notes, and snippets.

@IndianGuru
Created September 19, 2011 01:33
Show Gist options
  • Save IndianGuru/1225814 to your computer and use it in GitHub Desktop.
Save IndianGuru/1225814 to your computer and use it in GitHub Desktop.
JRuby Compiler course example1
require 'benchmark'
def factorial(n)
(1..n).inject(1) { |product, value| product * value }
end
3.times do
timing = Benchmark.measure do
result = factorial(10000)
end
puts timing
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment