Skip to content

Instantly share code, notes, and snippets.

@wuputah
Created December 16, 2012 07:55
Show Gist options
  • Select an option

  • Save wuputah/4304131 to your computer and use it in GitHub Desktop.

Select an option

Save wuputah/4304131 to your computer and use it in GitHub Desktop.
# t1 and t2 are Time objects
>> Benchmark.realtime { 1_000_000.times { 1000*(t2-t1) }}
=> 1.562801266
>> Benchmark.realtime { 1_000_000.times { t2-t1 }}
=> 1.014025201
>> Benchmark.realtime { 1_000_000.times { Time.now; Time.now } }
=> 2.133374417
>> Benchmark.realtime { 1_000_000.times { }}
=> 0.069858542
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment