summaryrefslogtreecommitdiffhomepage
path: root/test/profile.rb
blob: adbc7ab90e8255504c23732b12f14c5a1b130826 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env ruby -s
# frozen_string_literal: true

$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'axlsx'
require 'ruby-prof'

row = []
input1 = (32..126).to_a.pack('U*').chars.to_a # these will need to be escaped
input2 = (65..122).to_a.pack('U*').chars.to_a # these do not need to be escaped
10.times { row << input1.shuffle.join }
10.times { row << input2.shuffle.join }

profile = RubyProf.profile do
  p = Axlsx::Package.new
  p.workbook.add_worksheet do |sheet|
    10_000.times do
      sheet << row
    end
  end
  p.to_stream
end

printer = RubyProf::FlatPrinter.new(profile)
printer.print($stdout, {})