Created
March 17, 2019 20:48
-
-
Save kamipo/8346d67309405ef5f1e38e085df15681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "rails", github: "rails/rails" | |
gem "sqlite3" | |
gem "benchmark-ips" | |
end | |
require "active_record" | |
require "benchmark/ips" | |
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") | |
ActiveRecord::Schema.define do | |
create_table :foos do |t| | |
t.integer :value, default: 0 | |
end | |
end | |
class Foo < ActiveRecord::Base | |
end | |
Benchmark.ips do |x| | |
x.report("_insert_record") { Foo.create! } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment