Skip to content

Tail optimization for RRB-Vector (immut/vector) and new operations#3380

Merged
bobzhang merged 4 commits intomainfrom
CAIMEOX/rrb-vector
Mar 31, 2026
Merged

Tail optimization for RRB-Vector (immut/vector) and new operations#3380
bobzhang merged 4 commits intomainfrom
CAIMEOX/rrb-vector

Conversation

@CAIMEOX
Copy link
Copy Markdown
Collaborator

@CAIMEOX CAIMEOX commented Mar 27, 2026

This PR deprecates immut/array and adds a new implementation immut/vector, a tail-backed persistent vector with tree-local range operations and a tail-aware concat path.

  • switch the persistent layout to tree + tail
  • add peek, pop, split, take, drop, and slice
  • optimize concat with a tail-aware concat_with_suffix path

I also ran the benchmark. The delta below shows the change in this pull request relative to the base. A negative number indicates that the new version is faster. All values are in milliseconds.

case size × iters new base delta
new 0 × 200000 1.310 1.397 -6.2%
make 65536 × 64 0.586 0.672 -12.9%
makei 65536 × 32 3.572 6.830 -47.7%
from_array 65536 × 32 6.818 8.316 -18.0%
from_iter 65536 × 32 5.497 5.676 -3.2%
to_array 65536 × 32 5.253 5.228 +0.5%
length 65536 × 500000 2.132 2.257 -5.5%
is_empty 65536 × 500000 2.058 2.210 -6.9%
at 65536 × 65536 0.741 0.849 -12.8%
get 65536 × 65536 0.695 0.803 -13.5%
set 65536 × 4096 0.565 0.666 -15.2%
push 65536 × 20 31.183 123.366 -74.7%
concat 32768 × 1024 1.968 2.043 -3.7%
iter 65536 × 32 10.654 10.482 +1.6%
each 65536 × 32 8.749 8.783 -0.4%
eachi 65536 × 16 8.539 8.268 +3.3%
fold 65536 × 32 1.632 1.739 -6.1%
rev_fold 65536 × 32 1.621 1.762 -8.0%
map 32768 × 16 0.751 0.812 -7.5%

Open with Devin

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Mar 27, 2026

Pull Request Test Coverage Report for Build 3531

Details

  • 498 of 610 (81.64%) changed or added relevant lines in 9 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.6%) to 95.014%

Changes Missing Coverage Covered Lines Changed/Added Lines %
immut/vector/utils.mbt 29 31 93.55%
immut/vector/tree_pop.mbt 17 21 80.95%
immut/vector/tree_utils.mbt 21 25 84.0%
immut/vector/tree_append.mbt 44 59 74.58%
immut/vector/tree_slice.mbt 16 34 47.06%
immut/vector/vector.mbt 190 208 91.35%
immut/vector/tree.mbt 178 229 77.73%
Totals Coverage Status
Change from base Build 3527: -0.6%
Covered Lines: 14598
Relevant Lines: 15364

💛 - Coveralls

@CAIMEOX CAIMEOX changed the title Caimeox/rrb vector Tail optimization for RRB-Vector (immut/vector) and new operations Mar 27, 2026
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@bobzhang bobzhang force-pushed the CAIMEOX/rrb-vector branch from e7fa5a9 to cddc85e Compare March 31, 2026 00:57
@bobzhang
Copy link
Copy Markdown
Contributor

@codex do a review

@chatgpt-codex-connector
Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@bobzhang bobzhang merged commit 4525624 into main Mar 31, 2026
14 checks passed
@bobzhang bobzhang deleted the CAIMEOX/rrb-vector branch March 31, 2026 01:45
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.

3 participants