Crates.io | strumbra |
lib.rs | strumbra |
version | 0.5.2 |
source | src |
created_at | 2024-08-28 10:49:20.633121 |
updated_at | 2024-10-18 06:55:13.617727 |
description | An implementation for Umbra-style strings (also known as German strings) |
homepage | |
repository | https://gitlab.com/ltungv/strumbra |
max_upload_size | |
id | 1354476 |
size | 393,428 |
An implementation for the string data structure as described in Umbra: A Disk-Based System with In-Memory Performance.
3 different types are implemented:
BoxString
behaves like a Box<str>
.ArcString
behaves like a Arc<str>
.RcString
behaves like a Rc<str>
.Additionally, we define the following type aliases:
UniqueString = BoxString<4>
SharedString = ArcString<4>
u32::MAX
.Very simple micro-benchmarks were conducted to compare the performance of ordering strings of the different types - String
, UniqueString
, and SharedString
. We see no difference between UniqueString
and SharedString
as expected since they share the exact comparison implementation. When comparing 2 different random strings, performance is much better with UniqueString
and SharedString
because most comparisons only use the first few bytes.
On the other hand, comparing 2 identical strings yields better results using UniqueString
and SharedString
only when the strings have 4 bytes, so only the prefixes are compared. Otherwise, due to the conditional branches, UniqueString
and SharedString
perform similarly to String
when the strings can still be inlined and worse when the strings can't.