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

Function BenchmarkFory_NumericStructList_Deserialize

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

Source from the content-addressed store, hash-verified

304}
305
306func BenchmarkFory_NumericStructList_Deserialize(b *testing.B) {
307 writer := newFory()
308 reader := newForyReader()
309 obj := CreateNumericStructList()
310 data, err := writer.Serialize(&obj)
311 if err != nil {
312 b.Fatal(err)
313 }
314
315 if schemaMismatchEnabled() {
316 var result NumericStructListV2
317 if err := reader.Deserialize(data, &result); err != nil {
318 b.Fatal(err)
319 }
320 if len(result.NumericStructs) == 0 || result.NumericStructs[0].F1 != int64(obj.NumericStructs[0].F1) {
321 b.Fatal("NumericStructListV2 schema mismatch read failed")
322 }
323 b.ResetTimer()
324 for i := 0; i < b.N; i++ {
325 var result NumericStructListV2
326 if err := reader.Deserialize(data, &result); err != nil {
327 b.Fatal(err)
328 }
329 }
330 return
331 }
332
333 b.ResetTimer()
334 for i := 0; i < b.N; i++ {
335 var result NumericStructList
336 err := reader.Deserialize(data, &result)
337 if err != nil {
338 b.Fatal(err)
339 }
340 }
341}
342
343func BenchmarkProtobuf_NumericStructList_Deserialize(b *testing.B) {
344 rejectNonForySchemaMismatch(b)

Callers

nothing calls this directly

Calls 7

newForyReaderFunction · 0.85
CreateNumericStructListFunction · 0.85
newForyFunction · 0.70
schemaMismatchEnabledFunction · 0.70
int64Function · 0.50
SerializeMethod · 0.45
DeserializeMethod · 0.45

Tested by

no test coverage detected