diff options
| author | Zsolt Kozaroczy <[email protected]> | 2023-05-10 09:17:45 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-10 09:17:45 +0200 |
| commit | c7450e3ba630d6f71ae35ab32afd09e20bc7e8ac (patch) | |
| tree | a2206699b97209f5648092f9ceb08dced035a998 /test/profile_memory.rb | |
| parent | 916ba45a77302bcd6e81f2a61a6cff6a2f1f8367 (diff) | |
| parent | 88c26606594a2024e17adff9dd9853812dc839cc (diff) | |
| download | caxlsx-c7450e3ba630d6f71ae35ab32afd09e20bc7e8ac.tar.gz caxlsx-c7450e3ba630d6f71ae35ab32afd09e20bc7e8ac.zip | |
Merge pull request #220 from pkmiec/pipeDirectlyToOutput
Pipe directly to output
Diffstat (limited to 'test/profile_memory.rb')
| -rwxr-xr-x | test/profile_memory.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/profile_memory.rb b/test/profile_memory.rb new file mode 100755 index 00000000..15547b37 --- /dev/null +++ b/test/profile_memory.rb @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby -s +# frozen_string_literal: true + +$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib" +require 'axlsx' +require 'memory_profiler' + +# Axlsx.trust_input = true + +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 } + +report = MemoryProfiler.report do + p = Axlsx::Package.new + p.workbook.add_worksheet do |sheet| + 10_000.times do + sheet << row + end + end + p.serialize("example_memory.xlsx", zip_command: 'zip') +end +report.pretty_print + +File.delete("example_memory.xlsx") |
