MCPcopy Create free account
hub / github.com/apache/fory / BenchmarkProtobuf_NumericStruct_Serialize

Function BenchmarkProtobuf_NumericStruct_Serialize

benchmarks/go/benchmark_test.go:155–168  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

153}
154
155func BenchmarkProtobuf_NumericStruct_Serialize(b *testing.B) {
156 rejectNonForySchemaMismatch(b)
157 obj := CreateNumericStruct()
158
159 b.ResetTimer()
160 for i := 0; i < b.N; i++ {
161 // Fair comparison: convert struct to protobuf, then serialize
162 pbObj := ToPbStruct(obj)
163 _, err := proto.Marshal(pbObj)
164 if err != nil {
165 b.Fatal(err)
166 }
167 }
168}
169
170func BenchmarkMsgpack_NumericStruct_Serialize(b *testing.B) {
171 rejectNonForySchemaMismatch(b)

Callers

nothing calls this directly

Calls 4

CreateNumericStructFunction · 0.85
ToPbStructFunction · 0.85
MarshalMethod · 0.80

Tested by

no test coverage detected