Sha256: 9dcba18cf1ae586782590841b3daa0298ba91cf0e461692b4bc7aecbc626f933
Contents?: true
Size: 1.34 KB
Versions: 3
Compression:
Stored size: 1.34 KB
Contents
#!/usr/bin/env ruby require "xamplr" include Xampl require "tmp/XamplExample" include XamplExample require "benchmark" include Benchmark require 'persister/fsdb' require 'wee-cache/cache' class LRUCache < Cache::StorageCache def initialize(capacity=20) super(Cache::Strategy::LRU.new(capacity)) end end class LRU2Cache < Cache::StorageCache def initialize(capacity=20) super(Cache::Strategy::LRU2.new(capacity)) end end class LFUCache < Cache::StorageCache def initialize(capacity=20) super(Cache::Strategy::LFU.new(capacity)) end end module Bench def Bench.go count = 1000 capacity = 500 bm(15) do | x | x.report("XamplCache") { cache = XamplCache.new(capacity) count.times { | i | cache[i] = i } } x.report("XamplCacheLFU") { cache = XamplCacheLFU.new(capacity) count.times { | i | cache[i] = i } } x.report("LRU") { cache = LRUCache.new(capacity) count.times { | i | cache[i] = i } } x.report("LRU2") { cache = LRU2Cache.new(capacity) count.times { | i | cache[i] = i } } x.report("LFU") { cache = LFUCache.new(capacity) count.times { | i | cache[i] = i } } end end end Bench.go
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hutch-xamplr-1.0.0 | lib/xamplr/bench-cache.rb |
hutch-xamplr-1.0.1 | lib/xamplr/bench-cache.rb |
hutch-xamplr-1.0.2 | lib/xamplr/bench-cache.rb |