MCPcopy Index your code
hub / github.com/vmihailenco/msgpack / benchmarkJSONEncodeDecode

Function benchmarkJSONEncodeDecode

bench_test.go:46–61  ·  view source on GitHub ↗
(b *testing.B, src, dst interface{})

Source from the content-addressed store, hash-verified

44}
45
46func benchmarkJSONEncodeDecode(b *testing.B, src, dst interface{}) {
47 var buf bytes.Buffer
48 enc := json.NewEncoder(&buf)
49 dec := json.NewDecoder(&buf)
50
51 b.ResetTimer()
52
53 for i := 0; i < b.N; i++ {
54 if err := enc.Encode(src); err != nil {
55 b.Fatal(err)
56 }
57 if err := dec.Decode(dst); err != nil {
58 b.Fatal(err)
59 }
60 }
61}
62
63func BenchmarkBool(b *testing.B) {
64 var dst bool

Callers 1

Calls 2

EncodeMethod · 0.95
DecodeMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…