1
3
Fork
You've already forked phonebook
0
Mapping names to numbers, fast.
  • Rust 100%
2025年11月23日 15:54:56 +01:00
LICENSES Add a README and licenses 2025年09月24日 23:39:49 +02:00
src [lib] Define 'IdentID' 2025年09月24日 23:39:49 +02:00
.gitignore Set up Cargo 2025年09月24日 23:39:49 +02:00
Cargo.lock [Cargo.toml] Add 'atomic-wait' dependency 2025年09月24日 23:39:49 +02:00
Cargo.toml Fix up metadata 2025年11月23日 15:54:56 +01:00
README.md Fix up metadata 2025年11月23日 15:54:56 +01:00

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.