Sha256: e4a0debe6c45f2e7e83248b0883a6c7769b5e57580dcf9f963e9c3e023cac5b8
Contents?: true
Size: 1.34 KB
Versions: 39
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
39 entries across 39 versions & 2 rubygems