Sha256: 5bda8d4895c10efb07ffc3531e64c741be95808d1450b25ce88646cba5690d22

Contents?: true

Size: 468 Bytes

Versions: 2

Compression:

Stored size: 468 Bytes

Contents

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

puts
puts '--------------- Array#each_slice --------------'
puts '#i    user      system      total       real'

base_arr = Array.new(10000) { '-' * 10 }
arrs = [base_arr]

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

2 entries across 2 versions & 1 rubygems

Version Path
hyper_iterator-0.3.1 benchmark/memory_bm/each_slice.rb
hyper_iterator-0.3.0 benchmark/memory_bm/each_slice.rb