phonebook

Crates.iophonebook
lib.rsphonebook
version0.0.1
created_at2025-09-24 21:34:26.289004+00
updated_at2025-09-24 21:34:26.289004+00
descriptionMapping names to numbers, fast
homepagehttps://git.sr.ht/~bal-e/phonebook
repositoryhttps://git.sr.ht/~bal-e/phonebook
max_upload_size
id1853851
size15,467
arya dradjica (bal-e)

documentation

README

phonebook: Mapping names to numbers, fast

phonebook 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.

Alternatives

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.

Origins

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.

License

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.

Commit count: 0

cargo fmt