compact_str icon indicating copy to clipboard operation
compact_str copied to clipboard

feature: Immutable shared version of CompactStr?

Open NobodyXu opened this issue 2 years ago • 0 comments

Having a mutable CompactStr is great since it can be a drop-in replacement of String.

However, the original immutable CompactStr provides O(1) clone, which is super useful for immutable string, which is also super useful.

One of the issue with immutable CompactStr is that it makes #16 harder without performance penalty, as std::sync::Arc does not have stable API for MaybeUninit.

But that can be solved with triomphe::Arc as it provides new_uninit_slice methods for creating an uninitialized slice, which makes implementation of #16 possible without any performance penalty.

Also triomphe::Arc is 8 bytes smaller than std::sync::Arc, as it does not support weak reference, which is not used in this crate.

NobodyXu avatar Apr 04 '22 02:04 NobodyXu