summaryrefslogtreecommitdiff
path: root/file_test.go
diff options
context:
space:
mode:
authorHarris <mike.harris@cerner.com>2019-10-28 10:34:21 -0500
committerHarris <mike.harris@cerner.com>2019-11-05 08:18:11 -0600
commitbf9a8355494eac18812f3caf6d469962824f627f (patch)
tree023a4a3d98b0efcd38860a062f4fe26de81cbb81 /file_test.go
parent6abf8bf9723512086f009ca574bde1d6682fc83d (diff)
Reduce allocations when writing
Fix #494 If a row is full, don't bother allocating a new one, just return it. Use the last populated row as a hint for the size of new rows. Simplify checkSheet to remove row map
Diffstat (limited to 'file_test.go')
-rw-r--r--file_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/file_test.go b/file_test.go
new file mode 100644
index 0000000..6c30f4a
--- /dev/null
+++ b/file_test.go
@@ -0,0 +1,27 @@
+package excelize
+
+import (
+ "testing"
+)
+
+func BenchmarkWrite(b *testing.B) {
+ const s = "This is test data"
+ for i := 0; i < b.N; i++ {
+ f := NewFile()
+ for row := 1; row <= 10000; row++ {
+ for col := 1; col <= 20; col++ {
+ val, err := CoordinatesToCellName(col, row)
+ if err != nil {
+ panic(err)
+ }
+ f.SetCellDefault("Sheet1", val, s)
+ }
+ }
+ // Save xlsx file by the given path.
+ err := f.SaveAs("./test.xlsx")
+ if err != nil {
+ panic(err)
+ }
+ }
+
+}