- Rust 100%
| LICENSES | Add a README and licenses | |
| src | [lib] Define 'IdentID' | |
| .gitignore | Set up Cargo | |
| Cargo.lock | [Cargo.toml] Add 'atomic-wait' dependency | |
| Cargo.toml | Fix up metadata | |
| README.md | Fix up metadata | |
phonebook: Mapping names to numbers, fast
phonebook is a Rust library providing high-performance interning data
structures. It is primarily intended for compilers (i.e. interning identifiers
for name resolution), but it may be useful in other contexts as well.
phonebook tries to make room for more optimizations by providing specialized
APIs. These APIs take advantage of auxiliary work done by the caller to speed
things up even further.
Initial design work built on hashbrown and papaya, but quickly departed
into alternate designs and algorithms. 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 well-established, but phonebook's single
threaded interners can provide significantly better performance.
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.