提交 61bacc4a 编写于 作者: E Emilio Tagua 提交者: Jeremy Kemper

Add more examples in performance script.

[#5610 state:committed]
Signed-off-by: NJeremy Kemper <jeremy@bitsweat.net>
上级 68a4b1ea
......@@ -155,6 +155,23 @@ def self.feel(exhibits) exhibits.each { |e| e.feel } end
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册