string-interner
Efficient string interner with minimal memory footprint and fast access to the underlying strings.
0.20.0
36M downloads/mo
#1516 most downloaded on crates.io
robbepop/string-interner
What this package is like to depend on
Last release 3 months ago
30 Apr 2026
Release timing varies
gaps range from 2 months to 2.3 years
Some releases are documented
notes for 16 of 27 stable releases
8 versions withdrawn
withdrawn after publishing
10 years old
35 releases · first in 2017
1 release in the last 12 months
see the full history below
Release timeline
35 releases · Feb 2017 to Apr 2026Releases
latest 35-
0.20.030 Apr 2026 -
0.19.011 Feb 2025Nothing published for this version
-
0.18.012 Nov 2024Nothing published for this version
-
0.17.001 May 2024Nothing published for this version
-
0.16.001 May 2024Nothing published for this version
-
0.15.007 Feb 2024Nothing published for this version
-
0.14.027 Oct 2021Nothing published for this version
-
0.13.025 Aug 2021Release notes
Open source →-
Update
hashbrowndependency from version0.9to version0.11. -
Add
shrink_to_fitmethod toStringInternervia backend. (#36) -
Add support more than 4G of interned strings with
StringBackend. (#37) -
Remove
S: Symboltrait bound from interner backends. -
Remove
S: Symboltrait bound fromClone implforStringBackend. -
Reworked the memory and allocation tests
- Run them via
cargo test -- --test-threads 1
- Run them via
-
CI now tests the whole build for windows, linux (ubuntu) and macos.
-
Add
cargo-auditandcargo-outdatedchecks to CI pipeline. -
Remove no longer needed
jemallocdev-dependency.
-
-
0.12.211 Jan 2021Release notes
Open source →- Ensure cloned
StringInternercan still look up the same symbols. #34 (Thanks @alamb)- This requires
BuildHasher: Clonetrait bound forStringInterner'sCloneimpl.
- This requires
- Ensure cloned
-
0.12.114 Nov 2020Release notes
Open source →- The
BucketBackendnow implementsSend+Sync. - Implemented some minor internal improvements.
- Update dependencies:
hashbrown 0.8->0.9cfg-if 0.1->1.0
- The
-
0.12.015 Jul 2020Release notes
Open source →- Make
DefaultBackendgeneric over its symbol type.- This simplifies type ascription of string interners that do not use the
default symbol type.
- E.g.
StringInterner<usize>is now possible to write (again).
- E.g.
- This simplifies type ascription of string interners that do not use the
default symbol type.
- Add
backendscrate feature.- Enabled by default.
- Disable this if you do not use any of the backends provided by the
string-internercrate.
- Make
-
0.11.315 Jul 2020 -
0.11.215 Jul 2020Release notes
Open source →- Add new
StringBackendthat is optimized for memory allocations and footprint.- Use it if your memory constraints are most important to you.
- Add new
-
0.11.114 Jul 2020Release notes
Open source →Special thanks to Ten0 for help with this release!
- Remove usage of
unsafeinSymbol::try_from_usizemethods. - Remove no longer correct
unsafe implsforSendandSyncforStringInterner. - Add new crate feature
more-inlinethat puts more#[inline]on public methods.- The new
more-inlinecrate feature is enabled by default. If you want to turn it off use--no-default-features. - Enabling
more-inlinealso enableshashbrown/more-inline.
- The new
- Remove
&B: IntoItertrait bound fromCloneimpl ofStringInterner
- Remove usage of
-
0.11.014 Jul 2020 withdrawnRelease notes
Open source →Thanks a lot (again) to CAD97 who is the vanguard of the technical improvements in this release with their blog post.
- Significantly improved
StringInterner's memory consumption independend from the used internment backend. - Significantly improved
StringInterner's throughput for interning strings. - Change the
Backendtrait:internis no longerunsafeinternreturnsS(symbol type) instead of(InternedStr, S)- same as above for
intern_static - add
unsafe fn resolve_uncheckedwhich does the same asresolvebut explicitely without bounds checking
- No longer export
backend::InternedStrtype - Make
hashbrowna mandatory dependency. Note: We depend on it for the moment for itsraw_entryAPI that has not yet been stabilized for Rust. Also benchmarks show that it is 20-30% faster than Rust's hashmap implementation. - Benchmarks now show performance when using
FxBuildHasheras build hasher.
- Significantly improved
-
0.10.113 Jul 2020Release notes
Open source →- Allow to intern
&'static strusingget_or_intern_staticAPI.- This is a common use case and more efficient since the interner can skip some allocations in this special case.
- Fix bug in
SymbolU16andSymbolU32that instantiating them with values greater or equal tou16::MAXoru32::MAXrespectively caused them to panic instead of returningNone.- Special thanks to Ten0 for reporting the issue!
- Add a bunch of additional unit tests to further solifidy the implementation.
- Allow to intern
-
0.10.013 Jul 2020Release notes
Open source →Special thanks to CAD97 who motivated me to craft this release through their blog post "String interners in Rust". Also I want to thank matklad who wrote a nice blog post that inspired the design of the new
BucketBackendforStringInterner.-
Implement pluggable backends for
StringInterner. Uses the newBucketBackendby default which results in significant performance boosts and lower memory consumption as well as fewer overall memory allocations.This makes it possible for dependencies to alter the behavior of internment. The
string-internercrate comes with 2 predefined backends:SimpleBackend: Which is how theStringInternerof previous versions worked by default. It performs one allocation per interned string.BucketBackend: Tries to minimize memory allocations and packs interned strings densely. This is the new default behavior for this crate.
-
Due to the above introduction of backends some APIs have been removed:
reservecapacity- the entire
itermodule- Note: Simple iteration through the
StringInterer's interned strings and their symbols is still possible if the used backend supports iteration.
- Note: Simple iteration through the
resolve_unchecked: Has no replacement, yet but might be reintroduced in future versions again.shrink_to_fit: The API design was never really a good fit for interners.
-
-
0.9.012 Jul 2020Release notes
Open source →- Remove
Ordtrait bound fromSymboltrait- Also change
Symbol::from_usize(usize) -> SelftoSymbol::try_from_usize(usize) -> Option<Self>
- Also change
- Minor performance improvements for
DefaultSymbol::try_from_usize - Put all iterator types into the
itersub module - Put all symbol types into the
symbolsub module - Add new symbol types:
SymbolU16: 16-bit wide symbolSymbolU32: 32-bit wide symbol (default)SymbolUsize: same size asusize
- Various internal improvements and reorganizations
- Remove
-
0.8.012 Jul 2020Release notes
Open source →- Make it possible to use this crate in
no_stdenvironments- Use the new
hashbrowncrate feature together withno_std
- Use the new
- Rename
SymtoDefaultSymbol - Add
IntoIteratorimpl for&StringInterner - Add some
#[inline]annotations which improve performance for queries - Various internal improvements (uses
Pinself-referentials now)
- Make it possible to use this crate in
-
0.7.101 Sep 2019Release notes
Open source →- CRITICAL fix use after free bug in
StringInterner::clone() - implement
std::iter::ExtendforStringInterner Sym::from_usizenow avoids usingunsafecode- optimize
FromIteratorimpl ofStringInterner - move to Rust 2018 edition
Thanks YOSHIOKA Takuma for implementing this release.
- CRITICAL fix use after free bug in
-
0.7.007 Aug 2018 withdrawnRelease notes
Open source →- changed license from MIT to MIT/APACHE2.0
- removed generic impl of
Symbolfor types that areFrom<usize>andInto<usize> - removed
StringInterner::clearAPI since its usage breaks invariants - added
StringInterner::{capacity, reserve}APIs - introduced a new default symbol type
Symthat is a thin wrapper aroundNonZeroU32(idea by [koute][gh-user-koute]) - made
DefaultStringInternera type alias for the newStringInterner<Sym> - added convenient
FromIteratorimpl toStringInterner<S: Sym> - dev
- rewrote all unit tests (serde tests are still missing)
- entirely refactored benchmark framework
- added
html_root_urlto crate root
Thanks [matklad][gh-user-madklad] for suggestions and impulses
-
0.6.403 Sep 2019Release notes
Open source →- CRITICAL: fix use after free bug in
StringInterner::cloneimplementation.
- CRITICAL: fix use after free bug in
-
0.6.319 Sep 2017 withdrawnRelease notes
Open source →- fixed a bug that
StringInterner'sSendimpl didn't respect its genericHashBuilderparameter. Fixes GitHub [issue #4][gh-issue-4].
- fixed a bug that
-
0.6.213 Aug 2017 withdrawn -
0.6.131 Jul 2017 withdrawnRelease notes
Open source →- fixed a bug that inserting non-owning string types (e.g.
str) was broken due to dangling pointers (Thanks to artemshein for fixing it!)
- fixed a bug that inserting non-owning string types (e.g.
-
0.6.009 Jul 2017 withdrawnRelease notes
Open source →- added optional serde serialization and deserialization support
- more efficient and generic
PartialEqimplementation forStringInterner - made
StringInternergeneric overBuildHasherto allow for custom hashers
-
0.5.008 Jul 2017 withdrawnRelease notes
Open source →- added
IntoIteratortrait implementation forStringInterner - greatly simplified iterator code
- added
-
0.4.020 May 2017 withdrawn -
0.3.327 Feb 2017Release notes
Open source →- added
SendandSynctoInternalStrRefto makeStringInterneritselfSendandSync
- added
-
0.3.219 Feb 2017Nothing published for this version
-
0.3.110 Feb 2017Nothing published for this version
-
0.3.010 Feb 2017Nothing published for this version
-
0.2.110 Feb 2017Nothing published for this version
-
0.2.010 Feb 2017Nothing published for this version
-
0.1.006 Feb 2017Release notes
Open source →