2 releases

Uses old Rust 2015

0.1.1 Dec 28, 2019
0.1.0 Jun 6, 2016

#2462 in Data structures

Download history 1438/week @ 2024-03-22 1372/week @ 2024-03-29 1365/week @ 2024-04-05 1882/week @ 2024-04-12 1962/week @ 2024-04-19 900/week @ 2024-04-26 319/week @ 2024-05-03 292/week @ 2024-05-10 340/week @ 2024-05-17 212/week @ 2024-05-24 257/week @ 2024-05-31 332/week @ 2024-06-07 62/week @ 2024-06-14 10/week @ 2024-06-21 2/week @ 2024-06-28 2/week @ 2024-07-05

143 downloads per month

MIT license

9KB
168 lines

smallset: a small unordered set

Build Status

crates.io

Documentation

This crate implements a small unordered-set data structure implemented using smallvec. It stores set elements in a simple unordered array, and when the set is smaller than a parameterizable size, the elements are stored completely inline (i.e., with zero heap allocations). 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.

smallset should be used where minimizing heap allocations is of primary importance and where it is expected that no more than a few elements will be present. If the set grows large, then it will exhibit poor (O(n) queries and inserts) performance.

Dependencies

~105KB