Skip to content

Commit d4c441a

Browse files
committed
Add benchmark for larger document
1 parent 96fcef2 commit d4c441a

2 files changed

Lines changed: 1236 additions & 0 deletions

File tree

bench_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"bytes"
88
"io/fs"
99
"io/ioutil"
10+
"os"
1011
"path/filepath"
1112
"sort"
1213
"strings"
@@ -53,6 +54,20 @@ func BenchmarkDecode(b *testing.B) {
5354
}
5455
})
5556
}
57+
58+
b.Run("large-doc", func(b *testing.B) {
59+
d, err := os.ReadFile("testdata/ja-JP.toml")
60+
if err != nil {
61+
b.Fatal(err)
62+
}
63+
doc := string(d)
64+
65+
b.ResetTimer()
66+
for n := 0; n < b.N; n++ {
67+
var val map[string]interface{}
68+
toml.Decode(doc, &val)
69+
}
70+
})
5671
}
5772

5873
func BenchmarkEncode(b *testing.B) {

0 commit comments

Comments
 (0)