Module: Benchmark

Defined in:
lib/benchmarker.rb

Overview

for compatibility with ‘benchmark.rb’ (standard library)

Class Method Summary collapse

Class Method Details

.__new_bm(width, &block) ⇒ Object

:nodoc:



1022
1023
1024
1025
1026
1027
# File 'lib/benchmarker.rb', line 1022

def self.__new_bm(width, &block)   # :nodoc:
  bm = Benchmarker.new(width: width)
  scope = Benchmarker::Scope.new(bm)
  scope.instance_exec(scope, &block)
  return bm
end

.bm(width = nil, &block) ⇒ Object



1029
1030
1031
1032
1033
# File 'lib/benchmarker.rb', line 1029

def self.bm(width=nil, &block)
  #; [!2nf07] defines and runs benchmark.
  __new_bm(width, &block).run()
  nil
end

.bmbm(width = nil, &block) ⇒ Object



1035
1036
1037
1038
1039
# File 'lib/benchmarker.rb', line 1035

def self.bmbm(width=nil, &block)
  #; [!ezbb8] defines and runs benchmark twice, reports only 2nd result.
  __new_bm(width, &block).run(warmup: true)
  nil
end