Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

White-Green
Copy link

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
Copy link
Owner

orium commented Sep 18, 2024

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
Author

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

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
2 participants