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

Function BenchmarkFory_Sample_Serialize

benchmarks/go/benchmark_test.go:385–398  ·  view source on GitHub ↗

============================================================================ Sample Benchmarks ============================================================================

(b *testing.B)

Source from the content-addressed store, hash-verified

383// ============================================================================
384
385func BenchmarkFory_Sample_Serialize(b *testing.B) {
386 f := newFory()
387 obj := CreateSample()
388 buf := fory.NewByteBuffer(make([]byte, 0, 512))
389
390 b.ResetTimer()
391 for i := 0; i < b.N; i++ {
392 buf.Reset()
393 err := f.SerializeTo(buf, &obj)
394 if err != nil {
395 b.Fatal(err)
396 }
397 }
398}
399
400func BenchmarkProtobuf_Sample_Serialize(b *testing.B) {
401 rejectNonForySchemaMismatch(b)

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected