- The
serde
crate feature is no longer enabled viastd
crate feature. #73
- Removed the unused
cfg-if
dependency. #73
- Updated
hashbrown
dependency to0.15.1
. #73
- Fixed many
clippy
andformatting
issues. #73
- Added
StringInterner::resolve_unchecked
method. (#68)
- Fixed soundness issue in
BufferBackend::resolve
. (#68)
- Added
StringInterner::iter
method. (#65)
- Optimized
BufferBackend::{resolve, iter}
methods. (#64)
- Fixed unsoundness issue in
BucketBackend
. (#66)
- Removed
SimpleBackend
since it served no real purpose. (https://github.com/Robbepop/string-interner/commit/549db6c2efeac5acb5e8084e69fa22891ae14019)
- Update to
hashbrown
version0.14.0
. (#58) - Improve
no_std
support. (#44) - Fix bug in
BufferBackend::with_capacity
method. (#54)
- Added the new
BufferBackend
string 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_interner
crate now uses the Rust 2021 edition. - The
DefaultBackend
now is theStringBackend
and no longer theBucketBackend
. - The generic
S
symbol parameter of all string interner backends now defaults to theDefaultSymbol
. - The
Backend
trait is no longer generic over a symbolS
but instead has aSymbol
associated type now. - The
StringInterner
no longer has a genericS
symbol parameter and now instead uses theSymbol
associated type from its used backendB
.
- The
memory_consumption
tests now shrink the string interners before querying their memory consumption. This yields more stable numbers than before. - The
memory_consumption
test now also tests the total amount of allocations and deallocations made by the string interner backends. - Add
README
section about benchmarking the crate.
-
Update
hashbrown
dependency from version0.9
to version0.11
. -
Add
shrink_to_fit
method toStringInterner
via backend. (#36) -
Add support more than 4G of interned strings with
StringBackend
. (#37) -
Remove
S: Symbol
trait bound from interner backends. -
Remove
S: Symbol
trait bound fromClone impl
forStringBackend
. -
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-audit
andcargo-outdated
checks to CI pipeline. -
Remove no longer needed
jemalloc
dev-dependency
.
- Ensure cloned
StringInterner
can still look up the same symbols. #34 (Thanks @alamb)- This requires
BuildHasher: Clone
trait bound forStringInterner
'sClone
impl.
- This requires
- The
BucketBackend
now implementsSend
+Sync
. - Implemented some minor internal improvements.
- Update dependencies:
hashbrown 0.8
->0.9
cfg-if 0.1
->1.0
- Make
DefaultBackend
generic 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
backends
crate feature.- Enabled by default.
- Disable this if you do not use any of the backends provided by the
string-interner
crate.
- Add
Symbol
implementation forusize
.
- Add new
StringBackend
that 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
unsafe
inSymbol::try_from_usize
methods. - Remove no longer correct
unsafe impls
forSend
andSync
forStringInterner
. - Add new crate feature
more-inline
that puts more#[inline]
on public methods.- The new
more-inline
crate feature is enabled by default. If you want to turn it off use--no-default-features
. - Enabling
more-inline
also enableshashbrown/more-inline
.
- The new
- Remove
&B: IntoIter
trait bound fromClone
impl 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
Backend
trait:intern
is no longerunsafe
intern
returnsS
(symbol type) instead of(InternedStr, S)
- same as above for
intern_static
- add
unsafe fn resolve_unchecked
which does the same asresolve
but explicitely without bounds checking
- No longer export
backend::InternedStr
type - Make
hashbrown
a mandatory dependency. Note: We depend on it for the moment for itsraw_entry
API 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
FxBuildHasher
as build hasher.
- Allow to intern
&'static str
usingget_or_intern_static
API.- This is a common use case and more efficient since the interner can skip some allocations in this special case.
- Fix bug in
SymbolU16
andSymbolU32
that instantiating them with values greater or equal tou16::MAX
oru32::MAX
respectively 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 newBucketBackend
by 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-interner
crate comes with 2 predefined backends:SimpleBackend
: Which is how theStringInterner
of 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:
reserve
capacity
- the entire
iter
module- 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
Ord
trait bound fromSymbol
trait- Also change
Symbol::from_usize(usize) -> Self
toSymbol::try_from_usize(usize) -> Option<Self>
- Also change
- Minor performance improvements for
DefaultSymbol::try_from_usize
- Put all iterator types into the
iter
sub module - Put all symbol types into the
symbol
sub 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_std
environments- Use the new
hashbrown
crate feature together withno_std
- Use the new
- Rename
Sym
toDefaultSymbol
- Add
IntoIterator
impl for&StringInterner
- Add some
#[inline]
annotations which improve performance for queries - Various internal improvements (uses
Pin
self-referentials now)
- CRITICAL fix use after free bug in
StringInterner::clone()
- implement
std::iter::Extend
forStringInterner
Sym::from_usize
now avoids usingunsafe
code- optimize
FromIterator
impl 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
Symbol
for types that areFrom<usize>
andInto<usize>
- removed
StringInterner::clear
API since its usage breaks invariants - added
StringInterner::{capacity, reserve}
APIs - introduced a new default symbol type
Sym
that is a thin wrapper aroundNonZeroU32
(idea by koute) - made
DefaultStringInterner
a type alias for the newStringInterner<Sym>
- added convenient
FromIterator
impl toStringInterner<S: Sym>
- dev
- rewrote all unit tests (serde tests are still missing)
- entirely refactored benchmark framework
- added
html_root_url
to crate root
Thanks matklad for suggestions and impulses
- CRITICAL: fix use after free bug in
StringInterner::clone
implementation.
- fixed a bug that
StringInterner
'sSend
impl didn't respect its genericHashBuilder
parameter. Fixes GitHub issue #4.
- added
shrink_to_fit
public 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
PartialEq
implementation forStringInterner
- made
StringInterner
generic overBuildHasher
to allow for custom hashers
- added
IntoIterator
trait implementation forStringInterner
- greatly simplified iterator code
- removed restrictive constraint for
Unsigned
forSymbol
- added
Send
andSync
toInternalStrRef
to makeStringInterner
itselfSend
andSync