Thanks to visit codestin.com
Credit goes to lib.rs

#hash-map #non-cryptographic #serde #zero-heap #64-bit #address-space

stashmap

StashMap is a zero-heap non-cryptographic Minimal HashMap, with serde support

9 releases

Uses new Rust 2024

0.1.9 Feb 24, 2026
0.1.8 Feb 24, 2026

#1278 in Encoding

MIT license

11KB
235 lines

StashMap

On 64-bit architectures, every entry would require 24 bytes of memory which is needed for quick access, so 4096 entries would usually require ~98KB of memory.

struct DataStructure<'a> {
    data_slots: [Data; 32],
    index: StashMap<&'a str, u8, 4096>, // Efficient O(1) mapping from string keys to indices in the data_slots array
}

The bigger the address space, the less likely it is to encounter collisions (e.g. a call becoming O(2) or O(3) instead of O(1)), but it also consumes more memory.

Dependencies

~140KB