Sha256: 9600f74ccaed3d1f46ac1174fe5b62d40edcb510e7defb74af040a32ebb2643a

Contents?: true

Size: 788 Bytes

Versions: 7

Compression:

Stored size: 788 Bytes

Contents

require 'benchmark/ips'
require './setup'

Benchmark.ips do |x|
  x.report('SA initialize') do
    User.new(public: '1', published_at: '2016-01-01', age: '23')
  end

  x.report('AR-T initialize') do
    Looser.new(public: '1', published_at: '2016-01-01', age: '23')
  end
end

Benchmark.ips do |x|
  x.report('SA accessors') do
    u = User.new
    u.public = '1'
    u.published_at = '2016-01-01'
    u.age = '23'
  end

  x.report('AR-T accessors') do
    u = Looser.new
    u.public = '1'
    u.published_at = '2016-01-01'
    u.age = '23'
  end
end

Benchmark.ips do |x|
  x.report('SA create') do
    User.create!(public: '1', published_at: '2016-01-01', age: '23')
  end

  x.report('AR-T create') do
    Looser.create(public: '1', published_at: '2016-01-01', age: '23')
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
store_attribute-0.6.0 bench/bench.rb
store_attribute-0.5.3 bench/bench.rb
store_attribute-0.5.2 bench/bench.rb
store_attribute-0.5.1 bench/bench.rb
store_attribute-0.4.1 bench/bench.rb
store_attribute-0.5.0 bench/bench.rb
store_attribute-0.4.0 bench/bench.rb