(b *testing.B)
| 304 | } |
| 305 | |
| 306 | func 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 | |
| 343 | func BenchmarkProtobuf_NumericStructList_Deserialize(b *testing.B) { |
| 344 | rejectNonForySchemaMismatch(b) |
nothing calls this directly
no test coverage detected