aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/bench_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/encoding/json/bench_test.go')
-rw-r--r--src/encoding/json/bench_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/encoding/json/bench_test.go b/src/encoding/json/bench_test.go
index cd7380b1ef..ec5a88a4e2 100644
--- a/src/encoding/json/bench_test.go
+++ b/src/encoding/json/bench_test.go
@@ -221,3 +221,14 @@ func BenchmarkIssue10335(b *testing.B) {
}
}
}
+
+func BenchmarkUnmapped(b *testing.B) {
+ b.ReportAllocs()
+ var s struct{}
+ j := []byte(`{"s": "hello", "y": 2, "o": {"x": 0}, "a": [1, 99, {"x": 1}]}`)
+ for n := 0; n < b.N; n++ {
+ if err := Unmarshal(j, &s); err != nil {
+ b.Fatal(err)
+ }
+ }
+}