#insert #note #smolset #smol-set

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

#792 in Data structures

Download history 836/week @ 2024-12-17 149/week @ 2024-12-24 524/week @ 2024-12-31 467/week @ 2025-01-07 348/week @ 2025-01-14 274/week @ 2025-01-21 427/week @ 2025-01-28 1119/week @ 2025-02-04 653/week @ 2025-02-11 473/week @ 2025-02-18 1170/week @ 2025-02-25 504/week @ 2025-03-04 581/week @ 2025-03-11 546/week @ 2025-03-18 288/week @ 2025-03-25 348/week @ 2025-04-01

1,804 downloads per month
Used in 6 crates (3 directly)

MIT license

24KB
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

~69KB