#fallback #fork #find #set #element #elements #unordered #sizes #optimized

smolset

" An unordered set of elements optimized for small sizes. This is a fork of the original library with overhauled internals, better fallback perforamance (O(1) insert and find) and more features!

6 stable releases

Uses old Rust 2015

1.3.1 Sep 3, 2021
1.3.0 Jun 6, 2021
1.2.0 May 20, 2021
1.1.0 Aug 19, 2020

#692 in Data structures

Download history 155/week @ 2022-11-25 157/week @ 2022-12-02 344/week @ 2022-12-09 448/week @ 2022-12-16 272/week @ 2022-12-23 87/week @ 2022-12-30 225/week @ 2023-01-06 281/week @ 2023-01-13 537/week @ 2023-01-20 398/week @ 2023-01-27 254/week @ 2023-02-03 542/week @ 2023-02-10 845/week @ 2023-02-17 768/week @ 2023-02-24 633/week @ 2023-03-03 394/week @ 2023-03-10

2,725 downloads per month

MIT license

23KB
547 lines

SmolSet

Crate

This crate implements a small unordered-set data structure implemented using smallvec. It initially stores set elements in a simple unordered array. When the set is smaller than a parameterizable size, no allocations will be performed. The data structure is thus very space-efficient for sets of only a few elements, much more so than a tree-based or hash-table-based set data structure. It is also fast when the set is small: queries and inserts perform a linear scan, which is more cache-friendly than a pointer-chasing search through a tree.

However, as the set grows, it will transform internally into a std::collections::HashSet.

Note

This is a fork of the original library here: rust-smallset. I have rewritten the internals completely to not have such a bad fallback mode and added more features (and their tests and documentations).

Dependencies

~74KB