Repository navigation
Read VarBin UTF-8 RowFn inputs through their offsets - #10340
Conversation
Merging this PR will improve performance by 12.73%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | bitpack_blocked_compress_avx2 |
7.6 µs | 6.8 µs | +12.73% |
| 🆕 | WallTime | starts_with_avx2[64, VarBin] |
N/A | 57.3 µs | N/A |
| 🆕 | WallTime | starts_with_avx2[64, VarBinView] |
N/A | 124 µs | N/A |
| 🆕 | WallTime | starts_with_avx2[8, VarBin] |
N/A | 41.5 µs | N/A |
| 🆕 | WallTime | starts_with_avx2[8, VarBinView] |
N/A | 75.3 µs | N/A |
| 🆕 | WallTime | starts_with_avx512[64, VarBin] |
N/A | 56.7 µs | N/A |
| 🆕 | WallTime | starts_with_avx512[64, VarBinView] |
N/A | 124.6 µs | N/A |
| 🆕 | WallTime | starts_with_avx512[8, VarBin] |
N/A | 41 µs | N/A |
| 🆕 | WallTime | starts_with_avx512[8, VarBinView] |
N/A | 70.9 µs | N/A |
| 🆕 | WallTime | starts_with_neon[64, VarBin] |
N/A | 65.6 µs | N/A |
| 🆕 | WallTime | starts_with_neon[64, VarBinView] |
N/A | 114.9 µs | N/A |
| 🆕 | WallTime | starts_with_neon[8, VarBin] |
N/A | 44.2 µs | N/A |
| 🆕 | WallTime | starts_with_neon[8, VarBinView] |
N/A | 76.9 µs | N/A |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ct/row-fn-utf8-varbin-offsets (040d48c) with develop (9eb20ba)2
Footnotes
-
518 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
develop(46d518b) during the generation of this report, so 9eb20ba was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
|
Edit: CodSpeed no longer flags The CodSpeed check was red only because of Under callgrind, the Generated by Claude Code |
a51871e to
967721d
Compare
967721d to
90eae7e
Compare
|
Edit: #10352 merged before CI ran on
The last Generated by Claude Code |
`Utf8Column` executed every input to string views, so a `VarBin` input built a 16-byte view per row before any callback ran. It now borrows the `VarBin` offsets and bytes directly when the offsets fit in `u32` and delimit valid UTF-8, null rows included. Every other input still executes to views. Row callbacks now receive `&str`, which both storages produce, so `Utf8View` is removed. The row accessors carry `#[inline]`. They are not generic, so without it a row loop instantiated in another crate made a function call per row. `VarBinData::validate_utf8` already checked whether offsets delimit valid UTF-8. That check moves into `offsets_tile_utf8` so both paths share it. Signed-off-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018FefTpTuDky8bGPr5R9Loq
90eae7e to
040d48c
Compare
Summary
Replaces #10262 and #10263, whose offset elements needed a layout choice before
RowFn::dispatch, which only sees dtypes. HereUtf8Columnpicks its storage per batch, so every existing RowFn skips building a 16-byte view per row forVarBininput.Changes
Offsets that do not fit in
u32, or that delimit invalid UTF-8 at any row (null rows included), fall back to string views. The row accessors are now#[inline]because they are not generic, so row loops in other crates made one call per row, which is whyVarBinViewinput also got faster.On the new
row_fn_utf8_inputbench, astarts_withRowFn over 16,384 rows goes from 227.5 µs to 34.1 µs onVarBinwith 8-byte values and from 79.7 µs to 65.3 µs onVarBinViewwith 8-byte values.Benchmark methodology and full results
Baseline is
developat659c7f7. Candidate is this commit before its rebase ontod9ad4cf(a51871e). The two binaries ran alternately 7 times on a 4-core cloud VM with the bench profile. Each figure is the median of the 7 per-run divan medians. A later rerun of the rebased commit with only doc and comment changes matched these numbers.developVarBin, 8-byte valuesVarBin, 64-byte valuesVarBinView, 8-byte valuesVarBinView, 64-byte valuesAPI Changes
Utf8Columnnow yields&str, andUtf8Viewis removed. Callers that only dereference the value compile unchanged, butx == value.as_ref()becomes ambiguous becausestrimplementsAsReffor several targets, so compare againstvaluedirectly. A null row still yields an unspecified string, which offset storage now takes from the stored bytes instead of an empty string.🤖 Generated with Claude Code
https://claude.ai/code/session_018FefTpTuDky8bGPr5R9Loq