Skip to content

Commit

Permalink
fix benchmark files order (#518)
Browse files Browse the repository at this point in the history
Use slice instead of array to keep them always in place.
It's easier to watch for results when they are not mixed randomly each time.
  • Loading branch information
gabriel-vasile committed May 5, 2024
1 parent fd7639e commit 043efb9
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions mimetype_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,22 +500,22 @@ func BenchmarkSliceRand(b *testing.B) {
}

func BenchmarkCommon(b *testing.B) {
commonFiles := map[string]string{
"tar": "testdata/tar.tar",
"zip": "testdata/zip.zip",
"pdf": "testdata/pdf.pdf",
"jpg": "testdata/jpg.jpg",
"png": "testdata/png.png",
"gif": "testdata/gif.gif",
"xls": "testdata/xls.xls",
"webm": "testdata/webm.webm",
"xlsx": "testdata/xlsx.xlsx",
"pptx": "testdata/pptx.pptx",
"docx": "testdata/docx.docx",
}
for k, v := range commonFiles {
b.Run(k, func(b *testing.B) {
f, err := os.ReadFile(v)
commonFiles := []string{
"xlsx.xlsx",
"pptx.pptx",
"docx.docx",
"tar.tar",
"zip.zip",
"pdf.pdf",
"jpg.jpg",
"png.png",
"gif.gif",
"xls.xls",
"webm.webm",
}
for _, file := range commonFiles {
b.Run(filepath.Ext(file), func(b *testing.B) {
f, err := os.ReadFile(testDataDir + file)
if err != nil {
b.Fatal(err)
}
Expand Down

0 comments on commit 043efb9

Please sign in to comment.