26 releases (16 breaking)

0.19.0 Feb 11, 2025
0.18.0 Nov 12, 2024
0.17.0 May 1, 2024
0.15.0 Feb 7, 2024
0.3.3 Feb 27, 2017

#22 in Data structures

Download history 245221/week @ 2025-02-23 243931/week @ 2025-03-02 247077/week @ 2025-03-09 233131/week @ 2025-03-16 266031/week @ 2025-03-23 253210/week @ 2025-03-30 261460/week @ 2025-04-06 217797/week @ 2025-04-13 216887/week @ 2025-04-20 189754/week @ 2025-04-27 205797/week @ 2025-05-04 232335/week @ 2025-05-11 247554/week @ 2025-05-18 217236/week @ 2025-05-25 275058/week @ 2025-06-01 233440/week @ 2025-06-08

979,732 downloads per month
Used in 248 crates (45 directly)

MIT/Apache

68KB
1.5K SLoC

String Interner

Continuous Integration Test Coverage Documentation Crates.io
travisCI codecov docs crates

A data structure to cache strings efficiently, with minimal memory footprint and the ability to assicate the interned strings with unique symbols. These symbols allow for constant time comparisons and look-ups to the underlying interned string contents. Also, iterating through the interned strings is cache efficient.

Contributing

Testing

Test the project using

cargo test --release

Memory Allocation Tests

To further test memory consumption and allocations performed by the different string interner backends test the project as follows:

cargo test --release --features test-allocations -- --test-threads 1
  • The --features test-allocations enables the memory allocations tests.
  • The --test-thread 1 argument is required for the memory allocations tests since otherwise they interfere with each other causing them to randomly fail.
  • Use --nocapture to receive verbose output useful for debugging.

Profiling & Benchmarks

Benchmark the string interner and its various backends using

cargo bench

License

Licensed under either of

at your option.

Dual licence: badge badge

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

Dependencies

~0.6–1MB
~16K SLoC