Skip to content

Instantly share code, notes, and snippets.

@nicksieger
Created August 29, 2008 19:52
Show Gist options
  • Save nicksieger/8044 to your computer and use it in GitHub Desktop.
Save nicksieger/8044 to your computer and use it in GitHub Desktop.
require File.dirname(__FILE__) + '/bench_model'
puts "Widget.find(:all)"
Benchmark.bm do |make|
TIMES.times do
make.report do
10_000.times do
Widget.find(:all)
end
end
end
end
$ ruby bench/bench_find_all.rb
Loading ActiveRecord w/o gems...FAILED.
Loading ActiveRecord with gems...version 2.1.0
Widget.find(:all)
user system total real
1.540000 0.190000 1.730000 ( 3.109335)
1.460000 0.180000 1.640000 ( 2.725948)
1.460000 0.170000 1.630000 ( 2.761769)
1.490000 0.180000 1.670000 ( 2.776414)
1.460000 0.180000 1.640000 ( 2.830401)
$ ruby -I ~/Projects/ruby/rails/activerecord/lib bench/bench_find_all.rb
Loading ActiveRecord w/o gems...version 2.1.0
Widget.find(:all)
user system total real
1.460000 0.180000 1.640000 ( 2.772874)
1.410000 0.180000 1.590000 ( 2.685485)
1.450000 0.170000 1.620000 ( 2.760796)
1.420000 0.180000 1.600000 ( 2.699878)
1.450000 0.180000 1.630000 ( 2.755234)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment