mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add more examples in performance script.
[#5610 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
This commit is contained in:
parent
68a4b1eac9
commit
61bacc4ada
1 changed files with 17 additions and 0 deletions
|
@ -155,6 +155,23 @@ RBench.run(TIMES) do
|
|||
ar { Exhibit.transaction { Exhibit.new } }
|
||||
end
|
||||
|
||||
report 'Model.find(id)' do
|
||||
id = Exhibit.first.id
|
||||
ar { Exhibit.find(id) }
|
||||
end
|
||||
|
||||
report 'Model.find_by_sql' do
|
||||
ar { Exhibit.find_by_sql("SELECT * FROM exhibits WHERE id = #{(rand * 1000 + 1).to_i}").first }
|
||||
end
|
||||
|
||||
report 'Model.log', (TIMES * 10) do
|
||||
ar { Exhibit.connection.send(:log, "hello", "world") {} }
|
||||
end
|
||||
|
||||
report 'AR.execute(query)', (TIMES / 2) do
|
||||
ar { ActiveRecord::Base.connection.execute("Select * from exhibits where id = #{(rand * 1000 + 1).to_i}") }
|
||||
end
|
||||
|
||||
summary 'Total'
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue