Sha256: 4502023e956bde057edb16a6dfe4e9531b3154e85c4a8436d2e59e63f63da4e7
Contents?: true
Size: 721 Bytes
Versions: 15
Compression:
Stored size: 721 Bytes
Contents
require 'rubygems' require 'benchmark' require_relative 'cache_runner' RUNS = 400 class ARCreator include ActiveRecordObjects end def run(obj) obj.prepare GC.start Benchmark.measure do obj.run end ensure obj.cleanup end def benchmark(runners, label_width=0) IdentityCache.cache.clear runners.each do |runner| print "#{runner.name}: ".ljust(label_width) puts run(runner.new(RUNS)) end end def bmbm(runners) label_width = runners.map{ |r| r.name.size }.max + 2 width = label_width + Benchmark::CAPTION.size puts 'Rehearsal: '.ljust(width, '-') benchmark(runners, label_width) puts '-' * width benchmark(runners, label_width) end create_database(RUNS) bmbm(CACHE_RUNNERS)
Version data entries
15 entries across 15 versions & 1 rubygems