MCPcopy Index your code
hub / github.com/Robbepop/string-interner

github.com/Robbepop/string-interner @v0.20.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.20.0 ↗ · + Follow
173 symbols 294 edges 14 files 24 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

  • Apache license, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

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.

Extension points exported contracts — how you extend this code

Backend (Interface)
Types implementing this trait may act as backends for the string interner. The job of a backend is to actually store, m [3 …
src/backend/mod.rs
BackendStats (Interface)
Stats for the backend. [3 implementers]
tests/tests.rs
BackendBenchmark (Interface)
(no doc) [3 implementers]
benches/setup.rs
Symbol (Interface)
Types implementing this trait can be used as symbols for string interners. The [`StringInterner::get_or_intern`](`crate [1 …
src/symbol.rs

Core symbols most depended-on inside this repo

len
called by 13
src/backend/bucket/fixed_str.rs
get
called by 8
src/interner.rs
generate_test_strings
called by 7
benches/setup.rs
get_or_intern
called by 7
src/interner.rs
to_usize
called by 6
src/symbol.rs
iter
called by 6
src/interner.rs
expect_valid_symbol
called by 5
src/symbol.rs
len
called by 5
src/interner.rs

Shape

Method 113
Function 38
Class 18
Interface 4

Languages

Rust100%

Modules by API surface

src/backend/buffer.rs37 symbols
src/interner.rs23 symbols
src/backend/string.rs21 symbols
src/backend/bucket/mod.rs19 symbols
tests/allocator.rs16 symbols
benches/setup.rs14 symbols
src/serde_impl.rs11 symbols
benches/bench.rs9 symbols
src/symbol.rs7 symbols
src/backend/bucket/fixed_str.rs6 symbols
src/backend/bucket/interned_str.rs5 symbols
tests/tests.rs3 symbols

For agents

$ claude mcp add string-interner \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page