diff options
author | Michael <osiris2918@gmail.com> | 2019-03-23 03:09:48 -0500 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2019-03-23 16:09:48 +0800 |
commit | 2874d75555102b8266477cdda2966ff37dde6b12 (patch) | |
tree | 8ae0da9a1f477c36f49acef0889110dbf149892a /picture_test.go | |
parent | 677a22d99497fcc24135c949ab721d80ba5aa92a (diff) |
Add benchmark for adding images to sheet (#367)
* Add benchmark for adding images to sheet
This should help track performance regressions in future changes.
* Only transform sheet name if necessary
Diffstat (limited to 'picture_test.go')
-rw-r--r-- | picture_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/picture_test.go b/picture_test.go new file mode 100644 index 0000000..97d3cd9 --- /dev/null +++ b/picture_test.go @@ -0,0 +1,20 @@ +package excelize + +import ( + "fmt" + _ "image/png" + "io/ioutil" + "testing" +) + +func BenchmarkAddPictureFromBytes(b *testing.B) { + f := NewFile() + imgFile, err := ioutil.ReadFile("logo.png") + if err != nil { + panic("unable to load image for benchmark") + } + b.ResetTimer() + for i := 1; i <= b.N; i++ { + f.AddPictureFromBytes("Sheet1", fmt.Sprint("A", i), "", "logo", ".png", imgFile) + } +} |