Created
October 29, 2018 13:30
-
-
Save bogdan/31fbdf0cfe12bf55e07e275650d45c4f to your computer and use it in GitHub Desktop.
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
require "benchmark/ips" | |
quiet_logger | |
c = ActiveRecord::Base.connection | |
mysql = c.instance_variable_get("@connection") | |
sql = "select * from users where id = 1" | |
Benchmark.ips do |x| | |
x.time = 5 | |
x.warmup = 0.1 | |
x.report("ActiveRecord::Base") do | |
User.find(1) | |
end | |
x.report("Connection query") do | |
c.execute(sql) | |
end | |
x.report("No ActiveRecord") do | |
mysql.query(sql) | |
end | |
x.compare! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment