Created
October 29, 2019 17:31
-
-
Save mlh758/75a569faa798339b40859a3f594780b8 to your computer and use it in GitHub Desktop.
Excelize Save Benchmark
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment