Skip to content

perf(sequence): build single-match bitmap directly - #9262

Open
tomatotomata wants to merge 2 commits into
vortex-data:developfrom
tomatotomata:codex/sequence-compare-single-bit
Open

perf(sequence): build single-match bitmap directly#9262
tomatotomata wants to merge 2 commits into
vortex-data:developfrom
tomatotomata:codex/sequence-compare-single-bit

Conversation

@tomatotomata

Copy link
Copy Markdown

Summary

The sequence equality kernel knows that a match bitmap contains exactly one set bit, but it currently evaluates a predicate for every row to build that bitmap. This change allocates an unset BitBufferMut, sets the known match index, and freezes it. The existing iterator construction remains in the throughput benchmark as a baseline, alongside the single-set path at 1K, 100K, and 1M rows.

Testing

  • rustfmt on both changed files
  • git diff --check
  • Focused cargo test -p vortex-sequence --lib --no-default-features compute::compare::tests was attempted twice but could not complete because the shallow checkout needs the uncached tpchgen Git dependency.

AI assistance

This PR was prepared with agentic AI assistance. I inspected the issue and surrounding implementation, kept the change scoped to the requested path, and recorded the local validation limitation above.

Fixes #9092

}

const NUM_VALUES: u64 = 100_000;
const SEQUENCE_COMPARE_LENGTHS: [usize; 3] = [1_000, 100_000, 1_000_000];

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.

use NUM_VALUES

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Switched both comparison cases to the existing NUM_VALUES workload in b7f33d0.

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.

please read the benchmarking docs

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Read docs/developer-guide/benchmarking.md and updated both cases to pass the length and match index through with_inputs, removing the captured values and std::hint::black_box. The focused run measured 19.99 microseconds median for from_iter and 87.3 nanoseconds for the single-set path, both below the 1 ms per-iteration limit.

Comment on lines +59 to +61
let mut buffer = BitBufferMut::new_unset(lhs.len());
buffer.set(set_idx);
let buffer = buffer.freeze();

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.

NICE

Signed-off-by: ahmad <ahmadalgaidy@hotmail.com>
Signed-off-by: ahmad <ahmadalgaidy@hotmail.com>
@tomatotomata
tomatotomata force-pushed the codex/sequence-compare-single-bit branch from b7f33d0 to e1d3874 Compare August 8, 2026 00:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sequence compare bit buffer optimization (good first issue)

2 participants