Skip to content

Instantly share code, notes, and snippets.

@kylerippey
Created May 28, 2013 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kylerippey/5663887 to your computer and use it in GitHub Desktop.
Save kylerippey/5663887 to your computer and use it in GitHub Desktop.
Benchmark for minor_schema_migration_refactor pull request: https://github.com/rails/rails/pull/10766
require File.expand_path('../../../load_paths', __FILE__)
require "active_record"
require 'benchmark/ips'
TIME = (ENV['BENCHMARK_TIME'] || 20).to_i
RECORDS = (ENV['BENCHMARK_RECORDS'] || TIME*1000).to_i
conn = { :adapter => 'sqlite3', :database => ':memory:' }
ActiveRecord::Base.establish_connection(conn)
Benchmark.ips(TIME) do |x|
x.report("SchemaMigration#create_and_drop_table") do
ActiveRecord::SchemaMigration.create_table
ActiveRecord::SchemaMigration.drop_table
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment