Sequel Long Running Benchmarks


Benchmark Types
Show the last
Results
Compare

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

Actioncable/postgres Script View on Github

require 'bundler/setup'
require 'rails'

require_relative 'support/benchmark_rails.rb'
require_relative 'support/actioncable_helpers.rb'

PG_FAYE = Faye::WebSocket::Client.new("ws://127.0.0.1:4001/")

pg_tcp_addr = ENV['POSTGRES_PORT_5432_TCP_ADDR'] || 'localhost'
pg_port = ENV['POSTGRES_PORT_5432_TCP_PORT'] || 5432
PG_DB_URL = "postgres://[email protected]#{pg_tcp_addr}:#{pg_port}/rubybench"

Benchmark.rails("actioncable/postgres", time: 10) do
  pg_config =  { adapter: 'postgresql', url: PG_DB_URL }.with_indifferent_access
  with_puma_server(ActionCable.server, 4001, pg_config) do |port|
    500.times do
      PG_FAYE.send(SUB)
      PG_FAYE.send(MSG)
    end
  end
end