Crates.io | umbra_slice |
lib.rs | umbra_slice |
version | 0.1.0 |
source | src |
created_at | 2024-11-07 23:12:51.727622 |
updated_at | 2024-11-07 23:12:51.727622 |
description | An owned slice type with German string optimizations |
homepage | |
repository | https://github.com/the-mikedavis/umbra_slice |
max_upload_size | |
id | 1440451 |
size | 55,707 |
umbra_slice
provides a generic slice type that can replace Box<[T]>
and Box<str>
. UmbraSlice<T>
is optimized to store small slices inline in a layout based on "German strings".
umbra_slice
was extracted from spellbook
. See the post "German string" optimizations in Spellbook for more details.
Eq
to disqualify strings with different lengths and prefixes quickly.u8
s.(Assuming a 64-bit machine.)
UmbraSlice<T>
and UmbraString
are designed for a specific use-case and should not be thought of as generic replacements for Vec<T>
/Box<[T]>
and String
/Box<str>
, respectively. If you need a generic replacement, consider one of many great existing crates like smallvec
. UmbraSlice<T>
differs from most existing crates because it focuses on emulating non-resizable, immutable slices rather than resizable and mutable Vec<T>
s (which typically take 24 bytes on the stack).
Umbra slices are immutable and have a shorter maximum length than Vecs or boxed slices. Umbra slices are meant to be used when you have very many (thousands+) slices or strings which are typically smaller than 14 bytes.
Licensed under either of:
at your option.