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 with_capacity constructor #1100

Open
josecelano opened this issue Apr 8, 2024 · 0 comments
Open

Add with_capacity constructor #1100

josecelano opened this issue Apr 8, 2024 · 0 comments

Comments

@josecelano
Copy link

See: https://docs.rs/skiplist/latest/skiplist/skipmap/struct.SkipMap.html#method.with_capacity

Does it make sense to add a constructor to pre-allocate items in the skip list like in the other implementation.

use skiplist::SkipMap;

let mut skipmap = SkipMap::with_capacity(100);
skipmap.extend((0..100).map(|x| (x, x)));

I'm using the SkipMap, and I wonder if the application would be faster adding items, if we pre-allocated memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants