Groovy Speed 2 - Groovin' with Groovy
def benchmark(n)
  start = Time.now
  n.times { yield }
  delta = Time.now - start
  (delta.to_f / n.to_f) * 1000
end

def fact(n)
  (2..n).inject(1) { |f, i| f * i }
end

t = benchmark(10000) { fact(10) }
puts "Ruby:   #{1000*t} MicroSeconds per call"
Ruby:   99.5389 MicroSeconds per call