Add scalar function performance baselines - #9136
Conversation
Merging this PR will not alter performance
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| 🆕 | Simulation | inline[4096] |
N/A | 141.1 µs | N/A |
| 🆕 | Simulation | inline[65536] |
N/A | 1.8 ms | N/A |
| 🆕 | Simulation | nullable_out_of_line[4096] |
N/A | 156.8 µs | N/A |
| 🆕 | Simulation | nullable_out_of_line[65536] |
N/A | 1.8 ms | N/A |
| 🆕 | Simulation | out_of_line[4096] |
N/A | 141.7 µs | N/A |
| 🆕 | Simulation | out_of_line[65536] |
N/A | 1.8 ms | N/A |
| 🆕 | Simulation | add_i32_nonnull |
N/A | 915.7 µs | N/A |
| 🆕 | Simulation | add_i64_constant |
N/A | 1.2 ms | N/A |
| 🆕 | Simulation | add_u32_nonnull |
N/A | 916.7 µs | N/A |
| 🆕 | Simulation | nullable_out_of_line_90pct[4096] |
N/A | 169.6 µs | N/A |
| 🆕 | Simulation | nullable_out_of_line_90pct[65536] |
N/A | 1.8 ms | N/A |
| 🆕 | Simulation | like_per_row_distinct_patterns |
N/A | 628.3 µs | N/A |
| 🆕 | Simulation | like_per_row_repeated_patterns |
N/A | 173.1 µs | N/A |
| 🆕 | Simulation | column_x_column_points |
N/A | 720.4 µs | N/A |
| 🆕 | Simulation | column_x_column_polygons |
N/A | 1.1 ms | N/A |
| 🆕 | Simulation | constant_x_nullable_points |
N/A | 1.6 ms | N/A |
| 🆕 | Simulation | constant_x_nullable_polygons_disjoint |
N/A | 1.8 ms | N/A |
| 🆕 | Simulation | constant_x_points |
N/A | 1.4 ms | N/A |
| 🆕 | Simulation | constant_x_polygons_disjoint |
N/A | 1.6 ms | N/A |
| 🆕 | Simulation | column_x_column_polygons |
N/A | 1 ms | N/A |
| ... | ... | ... | ... | ... | ... |
ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.
Comparing ct/scalar-fn-baselines (210a2c8) with ct/l2-denorm-encoding (a562e60)
Footnotes
-
1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩
1fb231a to
c82b8f3
Compare
c82b8f3 to
71787a7
Compare
71787a7 to
880ddac
Compare
|
This benchmark has a too long runtime |
880ddac to
69edd3a
Compare
f599518 to
9fcb4a7
Compare
1dccaaf to
bf814bb
Compare
bf814bb to
003cc85
Compare
003cc85 to
9755708
Compare
|
Still too long |
|
@joseph-isaacs what is too long? which one? https://github.com/vortex-data/vortex/blob/develop/docs/developer-guide/benchmarking.md has nothing about benchmarks being too long, can you make a PR there? |
|
column_x_column_polygons | N/A | 23.8 ms |
|
@joseph-isaacs this is unhelpful. There are other benchmarks here that are longer too (i.e. 123ms). Is there some limit here that is undocumented? Why is it bad for microbenchmarks to be "long" in the first place if we're still able to get useful info out of it? |
|
They’re not very micro benchmarks with that runtime. I think in aggregate there’s ~30 non compliant benchmarks. This numbers is an arbitrary threshold we keep to stop them from decaying over time |
|
I usually think under 1 ms is a good target unless there is a very good reason to go above this. If we go above this two things happen:
|
…9176) ## Rationale for this change The benchmarking guide asked for "less than 1ms" per iteration without saying whether that was an aspiration or a limit, and without saying which number to measure against it. That gap showed up in review on #9136, where benchmarks landed at 23.8 ms and 123.4 ms per iteration. The review conversation there had no documented rule to point at — as noted on that PR, the guide "has nothing about benchmarks being too long". This documents the rule first, on its own, so it can be cited independently of any tooling that enforces it. ## What changes are included in this PR? Docs only — one section of `docs/developer-guide/benchmarking.md`: - States that **1 ms is the maximum, not a soft target**. - Says what to do when a benchmark does not fit: shrink the input, split it into smaller parameterized cases, or gate it with `#[cfg(not(codspeed))]`. - Names the number to check: the **per-iteration** time CodSpeed reports under `HEAD` for every benchmark a PR adds or changes — not the runtime of the whole benchmark binary, which is what "this benchmark takes too long" usually gets confused with. The heading loses its `~` (`under ~1 ms` → `under 1 ms`), which leaves the existing anchor `#keep-per-iteration-execution-time-under-1-ms` unchanged. A follow-up branch adds CI that reads CodSpeed's report and comments when a new or changed benchmark exceeds this budget. It is deliberately kept out of this PR so the rule can be agreed on its own. ## What APIs are changed? Are there any user-facing changes? No code, no API changes. Documentation only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01FZJAp4wVgwTVhLyErCWFZn --- _Generated by [Claude Code](https://claude.ai/code/session_01FZJAp4wVgwTVhLyErCWFZn)_ Co-authored-by: Claude <noreply@anthropic.com>
9755708 to
57236cb
Compare
|
@joseph-isaacs everything is sub ms now |
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
57236cb to
210a2c8
Compare
HarukiMoriarty
left a comment
There was a problem hiding this comment.
The geo part micro benchmark looks good to me!
Measured against develop through #9136's own public-path bench, the RowFn port was 7.6-7.7x slower across every arm at 65536 rows (13.5us to 104us, divan fastest and median of 100 samples, best of two ABBA runs, Apple M4 Max). The non-nullable arms regressed as hard as the nullable ones, so this was never about masking or validity. Half of it was a defect worth recording: BytesLen::get called VarBinViewArray::views once per row, which is a host-buffer downcast, a vortex_expect whose panic path the optimizer cannot hoist, a length division and a slice reconstruction. Pointing Varying at the views slice instead took it from 104us to 52us. Bytes::get had the same bug. This is the trap the InputElement::get doc warns about, and the next person to add an element should assume Varying is load-bearing rather than decorative. The other half is not a defect. Develop's views().iter().map(...).collect() vectorizes to better than one row per cycle, while a strided four-byte field read widened to eight does not. The row executor itself is fine: row_checked_add hits 0.21ns per row on the same machine, matching both a specialized control and develop's byte_length, while reading two input columns instead of one. So byte_length is the outlier, and it is the case #9128 already excludes, where a row is not the natural unit of work. Reverting the port leaves Bytes, BytesColumn and BytesLen with no caller, so they go too, along with the two branch-only byte benches. Shout keeps its coverage as a test-local element, since it was the crate's only non-dense-safe input and therefore the only in-crate exercise of the Filter contract and of branch-and-skip agreeing with filter-and-scatter. The two compile_fail doctests move to inline elements; both were verified against a positive control, which caught two bugs in the rewrite where they had been failing for unrelated reasons. Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Summary
Tracking Issue: #9128
Adds stable scalar function performance baselines for
byte_length,l2_norm,normalized,inner_product,cosine_similarity,GeoContains, andGeoIntersects.The benchmark sizes are all comfortably above the roughly 146-instruction Divan harness floor from #9011. Each benchmark binary also uses vendored
mimalloc, since scalar function execution allocates its output inside the timed trace and glibc differences between runner images caused the flakes fixed in #8861.Why
Codspeed can only compare a later implementation change when the same benchmark name already exists on
develop, so these baselines need to land before theRowFnthings I want to make. And these are pretty cheap, might as well add them.