Rails Releases Benchmarks


Benchmark Types

Activerecord/postgres scope where Graph (Number of iterations per second)

Activerecord/postgres scope where Graph (Allocated objects)

You can run this benchmark locally using the rubybench_runner gem:

gem install rubybench_runner
rubybench_runner run rails/bm_activerecord_scope_where.rb
More details here.

Activerecord/postgres scope where Script View on Github

require 'bundler/setup'
require 'active_record'
require_relative 'support/benchmark_rails'

db_setup script: "bm_scope_where_setup.rb"

ActiveRecord::Base.establish_connection(ENV.fetch('DATABASE_URL'))
ActiveRecord::Migration.verbose = false

class User < ActiveRecord::Base; end

Benchmark.rails("activerecord/#{db_adapter}_scope_where", time: 5) do
  str = ""
  User
    .select(:name, :email)
    .where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
    .where("email LIKE :email", email: "foobar00%@email.com")
    .each { |user| str << "name: #{user.name} email: #{user.email}\n" }
end