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

Version Path
identity_cache-0.5.1 performance/cpu.rb
identity_cache-0.5.0 performance/cpu.rb
identity_cache-0.4.1 performance/cpu.rb
identity_cache-0.4.0 performance/cpu.rb
identity_cache-0.3.2 performance/cpu.rb
identity_cache-0.3.1 performance/cpu.rb
identity_cache-0.3.0 performance/cpu.rb
identity_cache-0.2.5 performance/cpu.rb
identity_cache-0.2.4 performance/cpu.rb
identity_cache-0.2.3 performance/cpu.rb
identity_cache-0.2.2 performance/cpu.rb
identity_cache-0.2.1 performance/cpu.rb
identity_cache-0.2.0 performance/cpu.rb
identity_cache-0.1.0 performance/cpu.rb
identity_cache-0.0.7 performance/cpu.rb