phonebook 0.0.1

Mapping names to numbers, fast
Documentation
  • Coverage
  • 0%
    0 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 14.96 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 989.47 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bal-e

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.