-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
3 changed files
with
36 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
~$*.xlsx | ||
test/Test*.xlsx | ||
*.out | ||
test/image3.png | ||
*.test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
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