Skip to content

Commit

Permalink
Add benchmark for larger document
Browse files Browse the repository at this point in the history
  • Loading branch information
arp242 committed Jun 7, 2023
1 parent 96fcef2 commit d4c441a
Show file tree
Hide file tree
Showing 2 changed files with 1,236 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bench_test.go
Expand Up @@ -7,6 +7,7 @@ import (
"bytes"
"io/fs"
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
Expand Down Expand Up @@ -53,6 +54,20 @@ func BenchmarkDecode(b *testing.B) {
}
})
}

b.Run("large-doc", func(b *testing.B) {
d, err := os.ReadFile("testdata/ja-JP.toml")
if err != nil {
b.Fatal(err)
}
doc := string(d)

b.ResetTimer()
for n := 0; n < b.N; n++ {
var val map[string]interface{}
toml.Decode(doc, &val)
}
})
}

func BenchmarkEncode(b *testing.B) {
Expand Down

0 comments on commit d4c441a

Please sign in to comment.