Skip to content

Instantly share code, notes, and snippets.

@wuputah
Created December 16, 2012 07:55
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 wuputah/4304131 to your computer and use it in GitHub Desktop.
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