Last active
August 29, 2015 13:59
-
-
Save srt32/10674145 to your computer and use it in GitHub Desktop.
benchmark_funds.rake_v0
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
desc 'Benchmark funds_raised methods' | |
ITERATIONS = 100_000 | |
task benchmark_sql: :environment do | |
GC.disable | |
campaign = Campaign.last | |
Benchmark.bm do |bm| | |
bm.report('sql') do | |
ITERATIONS.times do | |
campaign.funds_raised_sql | |
Campaign.connection.clear_query_cache | |
end | |
end | |
end | |
GC.enable | |
end | |
task benchmark_ruby: :environment do | |
GC.disable | |
campaign = Campaign.last | |
Benchmark.bm do |bm| | |
bm.report('ruby') do | |
ITERATIONS.times do | |
campaign.funds_raised_ruby | |
Campaign.connection.clear_query_cache | |
end | |
end | |
end | |
GC.enable | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is an updated gist at https://gist.github.com/srt32/10687302.