bench: add sort benchmarks for various data profile#23346
Conversation
| c.bench_function( | ||
| &format!("spm/{ordering}/{key_type}/payload_{payload_width}"), | ||
| |b| { | ||
| b.iter(|| { |
There was a problem hiding this comment.
Nice addition. One small thought: this benchmark builds TestMemoryExec and SortPreservingMergeExec inside b.iter. The setup cost is probably small compared with draining 400k rows, but moving it out of the timed section would make optimizer and runtime comparisons a bit cleaner.
Could we use iter_batched, like the benchmark above, so the measured part focuses more directly on stream execution and drain?
| match ordering { | ||
| "sorted" => (0..n).collect(), | ||
| "reverse" => (0..n).rev().collect(), | ||
| // Sorted except for ~1% of items misplaced to random positions |
There was a problem hiding this comment.
This makes sense, but I think a short comment would help future readers interpret the benchmark correctly. Since the nearly_sorted disorder is introduced before round-robin batch partitioning and per-partition sorting, SPM is seeing sorted input partitions whose membership came from a near-sorted arrival stream, rather than directly nearly-sorted partitions.
Which issue does this PR close?
N/A
Rationale for this change
I'm adding multiple sort optimization in the coming PRs and I need a benchmark to compare against main
What changes are included in this PR?
added benchmark for various data profiles
Are these changes tested?
N/A
Are there any user-facing changes?
Nope