Sha256: 9a0185016c36a5aafdff67934f0375d22900d0bc4272c44331a2153d0bbe907b

Contents?: true

Size: 581 Bytes

Versions: 61

Compression:

Stored size: 581 Bytes

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')
if ARGV[2]
  require 'rubygems'
  gem 'activerecord', ARGV[2]
else
  require 'active_record'
end

ActiveRecord::Base.establish_connection(:adapter => "mysql", :database => "basecamp")

class Post < ActiveRecord::Base; end

require 'benchmark'

RUNS = ARGV[0].to_i
if ARGV[1] == "profile" then require 'profile' end

runtime = Benchmark::measure {
  RUNS.times { 
    Post.find_all(nil,nil,100).each { |p| p.title }
  }
}

puts "Runs: #{RUNS}"
puts "Avg. runtime: #{runtime.real / RUNS}"
puts "Requests/second: #{RUNS / runtime.real}"

Version data entries

61 entries across 61 versions & 2 rubygems

Version Path
backlog-0.0.0 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.0.1 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.0.2 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.0.4 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.0.5 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.1.0 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.1.1 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.1.2 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.2.0 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.2.1 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.0 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.2 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.3 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.1 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.4 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.5 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.6 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.7 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.8 vendor/rails/activerecord/benchmarks/benchmark.rb
backlog-0.3.9 vendor/rails/activerecord/benchmarks/benchmark.rb