Skip to content

perf(onpair): speed up compression with onpair 0.2.1 and row training - #9806

Merged
gargiulofrancesco merged 8 commits into
developfrom
fg/onpair-compression-speedup
Sep 10, 2026
Merged

perf(onpair): speed up compression with onpair 0.2.1 and row training#9806
gargiulofrancesco merged 8 commits into
developfrom
fg/onpair-compression-speedup

Conversation

@gargiulofrancesco

Copy link
Copy Markdown
Contributor

Summary

Speed up OnPair compression by upgrading to onpair 0.2.1 and training directly from Vortex string views, avoiding the full input copy and temporary offsets buffer.

Changes

  • Use the published onpair 0.2.1 release with its sampling fixes and faster matcher construction.
  • Read inline and external values through the row API, treating null rows as empty and accumulating the byte count while collecting lengths.

Signed-off-by: Francesco Gargiulo <gargiulo.fr@gmail.com>
Signed-off-by: Francesco Gargiulo <gargiulo.fr@gmail.com>
@gargiulofrancesco gargiulofrancesco added the changelog/performance A performance improvement label Sep 8, 2026
@codspeed-hq

codspeed-hq Bot commented Sep 8, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 2195 untouched benchmarks
⏩ 218 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime arrow_checked_add_u32_neon[16384] 13.3 µs 20.5 µs -35.01%
WallTime words_gather_dispatch_avx2[1024] 46 ns 17 ns ×2.7

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fg/onpair-compression-speedup (5b05483) with develop (a13c246)2

Open in CodSpeed

Footnotes

  1. 218 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.

  2. No successful run was found on develop (9fdaa38) during the generation of this report, so a13c246 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

#[inline]
fn row(&self, i: usize) -> &[u8] {
let view = &self.views[i];
if self.lengths[i] == 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if len is 0 the view should also be 0, I would personally skip this branch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lengths[i] is also zero for nulls, but masking can leave their views nonempty

@robert3005 robert3005 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just the single comment

Comment thread encodings/onpair/src/compress.rs Outdated
flat.extend_from_slice(bytes);
offsets.push(u64::try_from(flat.len()).vortex_expect("offset must fit in u64"));
uncompressed_lengths
.push(i32::try_from(view.len()).vortex_expect("must fit in i32"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this cannot fail, use debug assert

Comment thread encodings/onpair/src/compress.rs Outdated
offsets.push(u64::try_from(flat.len()).vortex_expect("offset must fit in u64"));
uncompressed_lengths
.push(i32::try_from(view.len()).vortex_expect("must fit in i32"));
total_bytes += view.len() as usize;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't call len twice

Comment thread encodings/onpair/src/compress.rs Outdated
struct ViewRows<'a> {
views: &'a [BinaryView],
buffers: &'a [&'a ByteBuffer],
lengths: &'a [i32],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u32!!!

Comment thread encodings/onpair/src/compress.rs Outdated
@@ -61,32 +55,32 @@ pub fn onpair_compress(
match mask.bit_buffer() {
AllOr::All => {
for view in views {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zip views with uncompressed_lengths

Signed-off-by: Francesco Gargiulo <gargiulo.fr@gmail.com>
Signed-off-by: Francesco Gargiulo <gargiulo.fr@gmail.com>
Signed-off-by: Francesco Gargiulo <gargiulo.fr@gmail.com>
Signed-off-by: Francesco Gargiulo <gargiulo.fr@gmail.com>
@gargiulofrancesco
gargiulofrancesco merged commit d461efb into develop Sep 10, 2026
81 of 82 checks passed
@gargiulofrancesco
gargiulofrancesco deleted the fg/onpair-compression-speedup branch September 10, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants