Created
August 17, 2011 20:18
-
-
Save logankoester/1152499 to your computer and use it in GitHub Desktop.
Simple benchmarking for ActiveRecord Queries in rails console
This file contains 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
# Give it two procs to compare | |
def bm(o, n); reload!; puts "Running 10 times"; Benchmark.bmbm(10) { |x| x.report('Old Query:') { @olr = o.call }; x.report('New Query:') { @nr = n.call } }; reload!; puts 'Old Result:' ; table(@olr); puts 'New Result'; table(@nr); end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment