Skip to content

Add new API Vector::insert and Vector::remove - #96

Open
White-Green wants to merge 7 commits into
orium:mainfrom
White-Green:insert_remove
Open

Add new API Vector::insert and Vector::remove#96
White-Green wants to merge 7 commits into
orium:mainfrom
White-Green:insert_remove

Conversation

@White-Green

Copy link
Copy Markdown

This PR adds insert and remove APIs to Vector.
closes: #95

Implementation

Previously, a Node could hold up to 1 << bits child Nodes. By extending the range of child Nodes to (i << bits) / 2..=1 << bits, we achieve faster insert and remove operations. This also makes it easier to implement Vector::{push_front, drop_first} (#17).

Regressions

Due to the uncertainty in the number of child elements in a Node, index calculations in methods like get have become more complex. As a result, Vector::get is approximately 3.5 times slower in benchmarks. Additionally, many white-box tests related to the Node structure have been rewritten.

@orium

orium commented Sep 18, 2024

Copy link
Copy Markdown
Owner

Hi. I'll take a look at this but it will take me some time to review, as I've been busy. Probably the end of next month.

@White-Green

Copy link
Copy Markdown
Author

Thank you for taking the time. Please don't push yourself as I'm not in a hurry.

@stevefan1999-personal

Copy link
Copy Markdown

@orium this would be useful, consider putting this in the priority queue?

@orium
orium force-pushed the main branch 2 times, most recently from b02d9a1 to 45451fa Compare June 24, 2026 22:34
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.

Feature Request: Add insert and remove API to Vector similar to Vec

3 participants