Sha256: 00a9a718159a5a5260e58daefb9a429b0b1ce8cf03d9bc29e2fc2f62a682d8b7
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
module Viiite class Benchmark module Runner def with(hash) if block_given? org_tuple = @tuple @tuple = org_tuple.merge(hash) res = yield @tuple = org_tuple res else @tuple.merge!(hash) end end def range_over(range, name) range.each do |value| with(name => value){ yield value } end end def variation_point(name, value, &proc) with({name => value}, &proc) end def report(hash = {}, &block) hash = {:bench => hash.to_sym} unless hash.is_a?(Hash) with(hash) { GC.start tms = Viiite.measure(&block) with(:tms => tms){ output } } end protected def _each(&reporter) @tuple, @reporter = {}, reporter self.instance_eval(&definition) @tuple, @reporter = nil, nil end def output @reporter.call @tuple.dup end end # module Runner end # class Benchmark end # module Viiite
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
viiite-0.2.0 | lib/viiite/benchmark/runner.rb |