- Fixed the
IntoIteratorimpl that triggered a Rust compiler miscompilation in some versions. #80- See the associated
rustcissue.
- See the associated
- Updated and improved documentation about backend properties. #83 #84
- Update outdated dependencies. #82
- Added
serde::{Serialize,Deserialize}impls for all crate defined symbol types. #86
- Improve and modernize GitHub Actions CI. #81
- The
serdecrate feature is no longer enabled viastdcrate feature. #73
- Removed the unused
cfg-ifdependency. #73
- Updated
hashbrowndependency to0.15.1. #73
- Fixed many
clippyandformattingissues. #73
- Added
StringInterner::resolve_uncheckedmethod. (#68)
- Fixed soundness issue in
BufferBackend::resolve. (#68)
- Added
StringInterner::itermethod. (#65)
- Optimized
BufferBackend::{resolve, iter}methods. (#64)
- Fixed unsoundness issue in
BucketBackend. (#66)
- Removed
SimpleBackendsince it served no real purpose. (https://github.com/Robbepop/string-interner/commit/549db6c2efeac5acb5e8084e69fa22891ae14019)
- Update to
hashbrownversion0.14.0. (#58) - Improve
no_stdsupport. (#44) - Fix bug in
BufferBackend::with_capacitymethod. (#54)
- Added the new
BufferBackendstring interner backend.- This backend focuses on minimum memory consumption and allocations at the costs of decreased symbol resolution performance.
- Use this when memory consumption is your main concern.
- Added example of how to use a different string interner backend or symbol.
- Added library docs comparing all the different string interner backends.
- The
string_internercrate now uses the Rust 2021 edition. - The
DefaultBackendnow is theStringBackendand no longer theBucketBackend. - The generic
Ssymbol parameter of all string interner backends now defaults to theDefaultSymbol. - The
Backendtrait is no longer generic over a symbolSbut instead has aSymbolassociated type now. - The
StringInternerno longer has a genericSsymbol parameter and now instead uses theSymbolassociated type from its used backendB.
- The
memory_consumptiontests now shrink the string interners before querying their memory consumption. This yields more stable numbers than before. - The
memory_consumptiontest now also tests the total amount of allocations and deallocations made by the string interner backends. - Add
READMEsection about benchmarking the crate.
-
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.
- Ensure cloned
StringInternercan still look up the same symbols. #34 (Thanks @alamb)- This requires
BuildHasher: Clonetrait bound forStringInterner'sCloneimpl.
- This requires
- The
BucketBackendnow implementsSend+Sync. - Implemented some minor internal improvements.
- Update dependencies:
hashbrown 0.8->0.9cfg-if 0.1->1.0
- 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.
- Add
Symbolimplementation forusize.
- Add new
StringBackendthat is optimized for memory allocations and footprint.- Use it if your memory constraints are most important to you.
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
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.
- 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.
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 BucketBackend for StringInterner.
-
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.
- 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
- 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)
- 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.
- 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) - 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 for suggestions and impulses
- CRITICAL: fix use after free bug in
StringInterner::cloneimplementation.
- fixed a bug that
StringInterner'sSendimpl didn't respect its genericHashBuilderparameter. Fixes GitHub issue #4.
- added
shrink_to_fitpublic method toStringInterner- (by artemshein)
- fixed a bug that inserting non-owning string types (e.g.
str) was broken due to dangling pointers (Thanks to artemshein for fixing it!)
- added optional serde serialization and deserialization support
- more efficient and generic
PartialEqimplementation forStringInterner - made
StringInternergeneric overBuildHasherto allow for custom hashers
- added
IntoIteratortrait implementation forStringInterner - greatly simplified iterator code
- removed restrictive constraint for
UnsignedforSymbol
- added
SendandSynctoInternalStrRefto makeStringInterneritselfSendandSync