Skip to content

Add with_capacity constructor #1100

Closed as not planned
Closed as not planned
@josecelano

Description

@josecelano

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions