Created
December 3, 2008 07:32
-
-
Save chris/31459 to your computer and use it in GitHub Desktop.
Ruby benchmarking example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ruby benchmarking example | |
| Benchmark.bm(5) do |timer| | |
| date_range = [1.month.ago.to_date, 6.months.from_now.to_date] | |
| timer.report('old way') do | |
| 10.times do | |
| # do the old way of code here | |
| end | |
| end | |
| timer.report('new way') do | |
| 10.times do | |
| # do the new way of code here | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment