class Benchmark::IPS::Job::Entry

def initialize(label, action)

Raises:
  • (ArgumentError) - Raises when action is not String or not responding to +call+.

Parameters:
  • action (String, Proc) -- Code to be benchmarked.
  • label (#to_s) -- Label of Benchmarked code.
def initialize(label, action)
  @label = label
  # We define #call_times on the singleton class of each Entry instance.
  # That way, there is no polymorphism for `@action.call` inside #call_times.
  if action.kind_of? String
    compile_string action
    @action = self
  else
    unless action.respond_to? :call
      raise ArgumentError, "invalid action, must respond to #call"
    end
    @action = action
    if action.respond_to? :arity and action.arity > 0
      compile_block_with_manual_loop
    else
      compile_block
    end
  end
end