diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-09-10 17:09:26 -0300 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-09-10 13:15:13 -0700 |
commit | 61bacc4adaf1ed423ef4e4ca69b6ca90075d9ec3 (patch) | |
tree | 3d5eeb6e4517ec7509dfc03cef3798bb33db27fa | |
parent | 68a4b1eac9ae8c8c2ed66cb4b78a40abedc4dbdd (diff) | |
download | rails-61bacc4adaf1ed423ef4e4ca69b6ca90075d9ec3.tar.gz rails-61bacc4adaf1ed423ef4e4ca69b6ca90075d9ec3.tar.bz2 rails-61bacc4adaf1ed423ef4e4ca69b6ca90075d9ec3.zip |
Add more examples in performance script.
[#5610 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
-rw-r--r-- | activerecord/examples/performance.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/activerecord/examples/performance.rb b/activerecord/examples/performance.rb index b3e862873d..ccd60c6c69 100644 --- a/activerecord/examples/performance.rb +++ b/activerecord/examples/performance.rb @@ -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 |