Crates.io | phonebook |
lib.rs | phonebook |
version | 0.0.1 |
created_at | 2025-09-24 21:34:26.289004+00 |
updated_at | 2025-09-24 21:34:26.289004+00 |
description | Mapping names to numbers, fast |
homepage | https://git.sr.ht/~bal-e/phonebook |
repository | https://git.sr.ht/~bal-e/phonebook |
max_upload_size | |
id | 1853851 |
size | 15,467 |
phonebook
: Mapping names to numbers, fastphonebook
is a Rust library providing a high-performance, multi-threaded
identifier interning data structure. It is primarily intended for compilers
(i.e. interning identifiers for name resolution), but it may be useful in other
contexts as well.
phonebook
offers an unusual multi-threaded API, where interning has to
be performed through thread-local data structures. These structures cache
information and amortize the cost of inter-thread synchronization, greatly
improving performance.
The implementation is inspired by hashbrown
and papaya
, but has been
heavily specialized; the internal data structures are thoroughly documented and
explain the various design decisions involved.
string-interner
is a single-threaded interning library, which (currently)
builds on hashbrown
. It is likely faster than phonebook
, so prefer it if
your use case is single-threaded.
[symbol-table
] is a popular multi-threaded interning library; it is currently
implemented as a sharded hash table built on hashbrown
. It has a much more
general interface than phonebook
, and so may be easier to use, at the cost of
performance.
phonebook
was developed for krabby
, an experimental Rust compiler, due
to its strong performance requirements. It contains a number of interesting
optimizations for concurrent data structures, and its ideas may be applicable to
other data structures.
Copyright (C) 2025 arya dradjica (wkmejd078fo5mrqv@bal-e.org)
phonebook
is available under the MIT or Apache-2.0 licenses, at your option.
Their terms are available in LICENSES/MIT.txt
and LICENSES/Apache-2.0.txt
respectively.