Sha256: a6b20895e9336b9739087f087bddfa513a39606873d4b3b4db185a9ba8eeefbd

Contents?: true

Size: 663 Bytes

Versions: 10

Compression:

Stored size: 663 Bytes

Contents

# require 'perftools'
require 'pp'
require 'logger'
require 'benchmark'
require 'rubygems'

$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
require 'toystore'
require 'adapter/memory'

Toy.logger = ::Logger.new(STDOUT).tap { |log| log.level = ::Logger::INFO }

class User
  include Toy::Store
end

times = 10_000
user = User.new
id = user.id
attrs = user.persisted_attributes

adapter_result = Benchmark.realtime {
  times.times { User.adapter.write(id, attrs) }
}
toystore_result = Benchmark.realtime {
  times.times { User.create }
}

puts 'Client', adapter_result
puts 'Toystore', toystore_result
puts 'Ratio', toystore_result / adapter_result

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
toystore-0.13.1 perf/writes.rb
toystore-0.13.0 perf/writes.rb
toystore-0.12.0 perf/writes.rb
toystore-0.11.0 perf/writes.rb
toystore-0.10.4 perf/writes.rb
toystore-0.10.3 perf/writes.rb
toystore-0.10.2 perf/writes.rb
toystore-0.10.1 perf/writes.rb
toystore-0.10.0 perf/writes.rb
toystore-0.9.0 perf/writes.rb