module Tryouts::Drill::Sergeant::RBenchmark

def self.compare_realtime( options = {}, &block1 )

need hundreds of thousands of :inner_iterations.
by the blocks. For code blocks that execute extremely rapidly, you may
the strength of the hardware (CPU, RAM, disk), and the amount of work done
based on your situation. The exact number you should use will depend on
In order to achieve these goals, you will need to tweak :inner_iterations

block run.
(3) Minimize the proportion of any warmup time (and cooldown time) of one
1.0 seconds per iteration.
small (or else random variance will muddle the results). Aim for at least
(2) Execution time for one run of the blocks under test should not be too
of 10-20, but can be lower. Over 25 should be considered too high.
(1) Do not set :iterations too high. It should normally be in the range

:inner_iterations properly. There are a few things to bear in mind:
To use better-benchmark properly, it is important to set :iterations and

Whether to print a dot for each iteration (as a sort of progress meter).
:verbose
Maximum allowed p value in order to declare the results statistically significant.
:required_significance
Used to increase the time taken per iteration.
:inner_iterations
The number of times to execute the pair of blocks.
:iterations
Options:
def self.compare_realtime( options = {}, &block1 )
  require 'rsruby'
  
  options[ :iterations ] ||= 20
  options[ :inner_iterations ] ||= 1
  options[ :required_significance ] ||= 0.01
  if options[ :iterations ] > 30
    warn "The number of iterations is set to #{options[ :iterations ]}. " +
      "Using too many iterations may make the test results less reliable. " +
      "It is recommended to increase the number of :inner_iterations instead."
  end
  ComparisonPartial.new( block1, options )
end