Number of iterations per second
Allocated objects
Sequel/postgres scope where Script
View on Github
require 'bundler/setup'
require 'sequel'
require_relative 'support/benchmark_sequel'
db_setup script: "bm_scope_where_setup.rb"
DB = Sequel.connect(ENV.fetch('DATABASE_URL'))
class User < Sequel::Model; end
Benchmark.sequel("sequel/#{db_adapter}_scope_where", time: 5) do
str = ""
User
.select(:name, :email)
.where(name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.")
.where(Sequel.lit('email LIKE ?', 'foobar00%@email.com'))
.each { |user| str << "name: #{user.name} email: #{user.email}\n" }
end
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