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

Function BenchmarkFory_NumericStruct_Serialize

benchmarks/go/benchmark_test.go:140–153  ·  view source on GitHub ↗

============================================================================ NumericStruct Benchmarks ============================================================================

(b *testing.B)

Source from the content-addressed store, hash-verified

138// ============================================================================
139
140func BenchmarkFory_NumericStruct_Serialize(b *testing.B) {
141 f := newFory()
142 obj := CreateNumericStruct()
143 buf := fory.NewByteBuffer(make([]byte, 0, 128))
144
145 b.ResetTimer()
146 for i := 0; i < b.N; i++ {
147 buf.Reset()
148 err := f.SerializeTo(buf, &obj)
149 if err != nil {
150 b.Fatal(err)
151 }
152 }
153}
154
155func BenchmarkProtobuf_NumericStruct_Serialize(b *testing.B) {
156 rejectNonForySchemaMismatch(b)

Callers

nothing calls this directly

Calls 4

ResetMethod · 0.95
CreateNumericStructFunction · 0.85
SerializeToMethod · 0.80
newForyFunction · 0.70

Tested by

no test coverage detected