Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:fabfaf1bd8503fbf6d32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
>> require 'active_record'
=> true
>> ActiveRecord::Base.establish_connection(
?> :adapter => "sqlite3",
?> :database => "benchmark.db"
>> )
>> ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS active_record_models")
>> ActiveRecord::Base.connection.execute("CREATE TABLE active_record_models (id INTEGER UNIQUE, title STRING, text STRING)")
>> class ActiveRecordModel < ActiveRecord::Base
>> end
>> ActiveRecordModel.new
>> require 'benchmark'
 
# 3.0.7
 
>> Benchmark.measure { 100_000.times { ActiveRecordModel.new } }
=> 1.470000 0.000000 1.470000 1.474953
 
# 3.1.0.rc4
 
>> Benchmark.measure { 100_000.times { ActiveRecordModel.new } }
=> 7.910000 0.050000 7.960000 7.951169
 
>> Benchmark.measure { 100_000.times { ActiveRecordModel.new(:title => "foo", :text => "bar") } }
=> 15.380000 0.010000 15.390000 15.381160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.