Rails Long Running Benchmarks


Benchmark Types
Show the last
Results
Compare

Activerecord/mysql2 destroy Graph (Number of iterations per second)

Activerecord/mysql2 destroy Graph (Allocated objects)

You can run this benchmark locally using the rubybench_runner gem:

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

Activerecord/mysql2 destroy Script View on Github

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

db_setup script: "bm_destroy_setup.rb"

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

class User < ActiveRecord::Base; end

attributes = {
  name: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
  email: "[email protected]"
}

Benchmark.rails("activerecord/#{db_adapter}_destroy", time: 5) do
  # we need to create the record in order to delete it
  user = User.create!(attributes)
  user.destroy
end