module ConsoleUtils::BenchUtils
Benchmark utils¶ ↑
Provides the collection of tools for benchmarking
Public Instance Methods
chips[ .("report") {} | .compare! {} | ... ]
click to toggle source
Access to globally shared Benchmark.ips
object, which works out of a block and allows to change the stack “on the fly” and to keep the result during the work.
Examples¶ ↑
chips.("merge") { the_hash.merge(other_hash) } chips.("merge!") { the_hash.merge!(other_hash) } # => x.report(..) { ... } chips.compare! # compare two reports # add more reports: chips.("deep_merge") { the_hash.deep_merge(other_hash) } # change an existing: chips.("merge!") { the_hash.deep_merge!(other_hash) } chips.compare! # compare three reports # remove report labeled as "merge!": chips.del("merge!") # it is just a delegator of the hash: chips # => { "merge" => #<Proc:...>, ... } chips["merge"] # => #<Proc:...> chips.clear # clear procs
# File lib/console_utils/bench_utils.rb, line 42 def chips Chips.shared end