MCPcopy Create free account
hub / github.com/chain/txvm / BenchmarkUnmarshalJSONMap

Function BenchmarkUnmarshalJSONMap

encoding/json/json_test.go:46–66  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

44}
45
46func BenchmarkUnmarshalJSONMap(b *testing.B) {
47 cases := []struct {
48 name, data string
49 }{
50 {"null", `null`},
51 {"empty object", `{}`},
52 {"space before object", ` {}`},
53 {"single-level object", `{"a":"b", "c":"d"}`},
54 {"multi-level object", `{"a":{"b":"c"}, "d": [1,2,3]}`},
55 }
56
57 for _, c := range cases {
58 b.Run(c.name, func(b *testing.B) {
59 var m Map
60 data := []byte(c.data)
61 for i := 0; i < b.N; i++ {
62 m.UnmarshalJSON(data)
63 }
64 })
65 }
66}

Callers

nothing calls this directly

Calls 1

UnmarshalJSONMethod · 0.95

Tested by

no test coverage detected