MCPcopy
hub / github.com/pquerna/ffjson / BenchmarkMarshalJSONNativeReuse

Function BenchmarkMarshalJSONNativeReuse

tests/ff_test.go:114–131  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

112}
113
114func BenchmarkMarshalJSONNativeReuse(b *testing.B) {
115 record := newLogFFRecord()
116
117 buf, err := json.Marshal(&record)
118 if err != nil {
119 b.Fatalf("Marshal: %v", err)
120 }
121 b.SetBytes(int64(len(buf)))
122
123 enc := ffjson.NewEncoder(&NopWriter{})
124 b.ResetTimer()
125 for i := 0; i < b.N; i++ {
126 err := enc.Encode(record)
127 if err != nil {
128 b.Fatalf("Marshal: %v", err)
129 }
130 }
131}
132
133func BenchmarkSimpleUnmarshal(b *testing.B) {
134 record := newLogFFRecord()

Callers

nothing calls this directly

Calls 3

EncodeMethod · 0.95
newLogFFRecordFunction · 0.85
FatalfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…