Skip to content

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

Open
gargiulofrancesco wants to merge 5 commits into
developfrom
fg/onpair-compression-speedup
Open

perf(onpair): speed up compression with onpair 0.2.1 and row training#9806
gargiulofrancesco wants to merge 5 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 not alter performance

⚠️ 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.

✅ 2187 untouched benchmarks
⏩ 218 skipped benchmarks1


Comparing fg/onpair-compression-speedup (0ba1757) with develop (bffdca1)

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.

#[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>
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