lib/benchmark/trend.rb
def measure_execution_time(data = nil, repeat: 1, &work)
      inputs = data || range(1, 10_000)
      times  = []

      inputs.each_with_index do |input, i|
        GC.start
        measurements = []

        repeat.times do
          measurements << clock_time { work.(input, i) }
        end

        times << measurements.reduce(&:+).to_f / measurements.size
      end
      [inputs, times]
    end
def measure_execution_time(data = nil, repeat: 1, &work)
      inputs = data || range(1, 10_000)
      times  = []

      inputs.each_with_index do |input, i|
        GC.start
        measurements = []

        repeat.times do
          measurements << clock_time { work.(input, i) }
        end

        times << measurements.reduce(&:+).to_f / measurements.size
      end
      [inputs, times]
    end
Gather times for each input against an algorithm

 @param [Array[Numeric]] data
   the data to run measurements for

 @param [Integer] repeat
   nubmer of times work is called to compute execution time

 @return [Array[Array, Array]]

 @api public