| 355 | } |
| 356 | |
| 357 | func BenchmarkIteratorResultAppend(b *testing.B) { |
| 358 | testCases := []struct { |
| 359 | name string |
| 360 | inputResult *IteratorResult |
| 361 | }{ |
| 362 | { |
| 363 | name: "empty", |
| 364 | inputResult: &IteratorResult{}, |
| 365 | }, |
| 366 | { |
| 367 | name: "both results", |
| 368 | inputResult: &IteratorResult{ |
| 369 | Entries: []struct { |
| 370 | Key string |
| 371 | Value parquet.Value |
| 372 | }{ |
| 373 | {Key: "A", Value: parquet.Int32Value(1)}, |
| 374 | }, |
| 375 | OtherEntries: []struct { |
| 376 | Key string |
| 377 | Value interface{} |
| 378 | }{ |
| 379 | {Key: "B", Value: "test"}, |
| 380 | }, |
| 381 | }, |
| 382 | }, |
| 383 | { |
| 384 | name: "only entries", |
| 385 | inputResult: &IteratorResult{ |
| 386 | Entries: []struct { |
| 387 | Key string |
| 388 | Value parquet.Value |
| 389 | }{ |
| 390 | {Key: "A", Value: parquet.Int32Value(1)}, |
| 391 | }, |
| 392 | }, |
| 393 | }, |
| 394 | } |
| 395 | |
| 396 | ir := IteratorResult{} |
| 397 | for _, tc := range testCases { |
| 398 | b.Run(tc.name, func(b *testing.B) { |
| 399 | for i := 0; i < b.N; i++ { |
| 400 | ir.Reset() |
| 401 | ir.Append(tc.inputResult) |
| 402 | } |
| 403 | }) |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | type testIterator struct { |
| 408 | rows []IteratorResult |