MCPcopy Index your code
hub / github.com/segmentio/encoding / BenchmarkCodeEncoder

Function BenchmarkCodeEncoder

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

Source from the content-addressed store, hash-verified

83}
84
85func BenchmarkCodeEncoder(b *testing.B) {
86 b.ReportAllocs()
87 if codeJSON == nil {
88 b.StopTimer()
89 codeInit()
90 b.StartTimer()
91 }
92 b.RunParallel(func(pb *testing.PB) {
93 enc := NewEncoder(io.Discard)
94 for pb.Next() {
95 if err := enc.Encode(&codeStruct); err != nil {
96 b.Fatal("Encode:", err)
97 }
98 }
99 })
100 b.SetBytes(int64(len(codeJSON)))
101}
102
103func BenchmarkCodeMarshal(b *testing.B) {
104 b.ReportAllocs()

Callers

nothing calls this directly

Calls 4

EncodeMethod · 0.95
codeInitFunction · 0.85
NewEncoderFunction · 0.70
NextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…