summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam Gardiner <[email protected]>2013-04-15 10:49:02 +0100
committerAdam Gardiner <[email protected]>2013-04-15 10:49:02 +0100
commitbd6a3ebf91fd0677f3d31ecba4a22b9edb812406 (patch)
tree51e9f196a7ae61a86c4acad4d800b5f6c1df82a4
parentbe5cbe443d7cea3dd7cfc8aec4d984c34a0fb9bf (diff)
downloadcaxlsx-bd6a3ebf91fd0677f3d31ecba4a22b9edb812406.tar.gz
caxlsx-bd6a3ebf91fd0677f3d31ecba4a22b9edb812406.zip
Add benchmark for preserve space
-rw-r--r--test/benchmark.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/test/benchmark.rb b/test/benchmark.rb
index 2ef82eaf..3f017874 100644
--- a/test/benchmark.rb
+++ b/test/benchmark.rb
@@ -8,6 +8,7 @@ Axlsx::trust_input = true
row = []
input = (32..126).to_a.pack('U*').chars.to_a
20.times { row << input.shuffle.join}
+row_with_spaces = row.map{ |v| " #{v}" }
times = 3000
Benchmark.bmbm(30) do |x|
@@ -69,5 +70,18 @@ Benchmark.bmbm(30) do |x|
end
end
}
+
+ x.report('preserve-spaces') {
+ p = Axlsx::Package.new
+ p.workbook do |wb|
+ wb.add_worksheet do |sheet|
+ times.times do
+ sheet << row_with_spaces
+ end
+ end
+ end
+ s = p.to_stream()
+ File.open('example_preserve_spaces.xlsx', 'w') { |f| f.write(s.read) }
+ }
end
-File.delete("example.csv", "example_streamed.xlsx", "example_shared.xlsx", "example_autowidth.xlsx", "example_noautowidth.xlsx")
+File.delete("example.csv", "example_streamed.xlsx", "example_shared.xlsx", "example_autowidth.xlsx", "example_noautowidth.xlsx", "example_preserve_spaces.xlsx")