Sha256: b0ca7a6b6738cd7e63a349429b3d3b8ecc3ddb21e67ec40d2ae655d52e546399
Contents?: true
Size: 689 Bytes
Versions: 4
Compression:
Stored size: 689 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 identity_map_off store(:memory, {}) end times = 10_000 user = User.new id = user.id attrs = user.persisted_attributes client_result = Benchmark.realtime { times.times { User.store.write(id, attrs) } } store_result = Benchmark.realtime { times.times { User.create } } puts 'Client', client_result puts 'Toystore', store_result puts 'Ratio', store_result / client_result
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
toystore-0.8.3 | perf/writes.rb |
toystore-0.8.2 | perf/writes.rb |
toystore-0.8.1 | perf/writes.rb |
toystore-0.8.0 | perf/writes.rb |