Sha256: 1c3bdbe2afeb7e7b7257e6d65ad0a3b52225dc6224d8d6ad5f0487dd2d8dc238

Contents?: true

Size: 467 Bytes

Versions: 3

Compression:

Stored size: 467 Bytes

Contents

require 'benchmark'
require_relative '../../lib/hyper_iterator'
$stdout.sync = true

puts 'Array#each_slice'
puts 'creating array'
base_arr = Array.new(10000) { '-' * 10 }
arrs = [base_arr]
puts 'finished creating base array'
puts 'each iteration begins'

i = 0
while true
  print "#{i} "
  arr = []
  report = Benchmark.measure do
    arrs[i].each_slice!(100) do |sl|
      sl.each { |el| arr << el.dup }
    end
  end

  puts report
  arrs << arr
  i += 1
end

puts

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hyper_iterator-0.2.2 benchmark/memory_bm/each_slice_bang.rb
hyper_iterator-0.2.1 benchmark/memory_bm/each_slice_bang.rb
hyper_iterator-0.2.0 benchmark/memory_bm/each_slice_bang.rb