Skip to content

Use cursor copies for PiecewiseSequence slices#8832

Draft
danking wants to merge 1 commit into
codex/piecewise-sequence-varbin-takefrom
codex/piecewise-sequence-cursor-copy
Draft

Use cursor copies for PiecewiseSequence slices#8832
danking wants to merge 1 commit into
codex/piecewise-sequence-varbin-takefrom
codex/piecewise-sequence-cursor-copy

Conversation

@danking

@danking danking commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a shared checked cursor-copy helper for PiecewiseSequence slice gathering
  • replace extend_from_slice in the primitive, decimal, VarBinView, and VarBin PiecewiseSequence consumers
  • keep the safety checks explicit: each copy verifies the destination cursor range against the declared output length and capacity, and callers verify the final cursor before set_len

Validation

  • cargo +nightly fmt --all
  • cargo clippy -p vortex-array --all-targets --all-features -- -D warnings
  • cargo bench -p vortex-array --bench listview_rebuild
  • cargo bench -p vortex-array --bench cast_decimal
  • cargo test -p vortex-array piecewise_sequence

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 1795 untouched benchmarks
⏩ 52 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation take_fsl_u32_random[16, 1000] 126.9 µs 141.8 µs -10.51%
Simulation copy_nullable[65536] 1.4 ms 1 ms +32.03%
Simulation copy_non_nullable[65536] 1,089.5 µs 908.9 µs +19.87%

Tip

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


Comparing codex/piecewise-sequence-cursor-copy (534b70f) with codex/piecewise-sequence-varbin-take (5924fe3)2

Open in CodSpeed

Footnotes

  1. 52 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 codex/piecewise-sequence-varbin-take (79d9e10) during the generation of this report, so 24733c2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@danking
danking force-pushed the codex/piecewise-sequential-run-take-consumers branch from 9adf56d to c4a0358 Compare July 17, 2026 19:40
@danking
danking force-pushed the codex/piecewise-sequence-cursor-copy branch from f9a3472 to afcc04a Compare July 17, 2026 19:41
@danking
danking force-pushed the codex/piecewise-sequential-run-take-consumers branch from c4a0358 to c76531d Compare July 17, 2026 20:05
@danking danking added the changelog/performance A performance improvement label Jul 17, 2026
@danking
danking force-pushed the codex/piecewise-sequential-run-take-consumers branch from 80f7b89 to 30870aa Compare July 17, 2026 20:19
@danking
danking force-pushed the codex/piecewise-sequential-run-take-consumers branch from 30870aa to e777ab4 Compare July 17, 2026 20:25
@danking
danking force-pushed the codex/piecewise-sequence-cursor-copy branch from afcc04a to 1a17030 Compare July 17, 2026 20:29
@danking
danking changed the base branch from codex/piecewise-sequential-run-take-consumers to codex/piecewise-sequence-varbin-take July 17, 2026 20:29
@danking
danking force-pushed the codex/piecewise-sequence-varbin-take branch from 5924fe3 to 79d9e10 Compare July 17, 2026 20:38
Signed-off-by: Daniel King <dan@spiraldb.com>
@danking
danking force-pushed the codex/piecewise-sequence-cursor-copy branch from 1a17030 to 534b70f Compare July 17, 2026 20:39
let start = start.as_();
let length = length.as_();
result.extend_from_slice(&values[start..][..length]);
cursor = copy_slice_to_spare(&mut result, cursor, &values[start..][..length], output_len)?;

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.

I would benchmark having *mut T that you keep advancing for every value written so you always hold the next empty slot in that pointer. That's what we do for buffer extend

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.

2 participants