Sha256: 0822eef671b4219086000ecf09ba83f7c714e97630647a1d4bc3b13cb7a13e57

Contents?: true

Size: 854 Bytes

Versions: 1

Compression:

Stored size: 854 Bytes

Contents

require_relative 'init'

HEADERS = ["id", "name", "age", "date", "random"]

DATA = []
10_000.times do |n|
  DATA << [n, "String string #{n}" * 5, (n * rand * 10).round, Time.at(n * 1000 + 1492922688), n * 100]
end

puts "warm up..."
write_fast_excel_20k
write_axslx_20k
write_xlsx_20k

DATA.clear
100_000.times do |n|
  DATA << [n, "String string #{n}" * 5, (n * rand * 10).round, Time.at(n * 1000 + 1492922688), n * 100]
end

GC.start
sleep 5

def measure_memory(title)
  puts "Running test: #{title}"
  recorder = ProcessMemory.start_recording
  yield
  puts recorder.print("Done!")
  recorder.stop
  puts recorder.report_per_second_pretty
  puts
end

measure_memory("FastExcel") do
  write_fast_excel_20k
end

GC.start
sleep 5

measure_memory("Axslx") do
  write_axslx_20k
end

GC.start
sleep 5

measure_memory("write_axslx") do
  write_axslx_20k
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fast_excel-0.2.0 benchmarks/memory.rb