MCPcopy Create free account
hub / github.com/segmentio/encoding / BenchmarkCodeMarshal

Function BenchmarkCodeMarshal

json/golang_bench_test.go:103–118  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

101}
102
103func BenchmarkCodeMarshal(b *testing.B) {
104 b.ReportAllocs()
105 if codeJSON == nil {
106 b.StopTimer()
107 codeInit()
108 b.StartTimer()
109 }
110 b.RunParallel(func(pb *testing.PB) {
111 for pb.Next() {
112 if _, err := Marshal(&codeStruct); err != nil {
113 b.Fatal("Marshal:", err)
114 }
115 }
116 })
117 b.SetBytes(int64(len(codeJSON)))
118}
119
120func benchMarshalBytes(n int) func(*testing.B) {
121 sample := []byte("hello world")

Callers

nothing calls this directly

Calls 3

codeInitFunction · 0.85
MarshalFunction · 0.70
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…