In benchmarks, it uses 35% – 64% less memory than Rust's std String and other Rust short-string libraries.
ColdString is an 8-byte tagged pointer (4 bytes on 32-bit machines) that can inline up to 8 bytes for character storage. Otherwise, the pointer points to the heap where both the length and characters are stored. The length is encoded as a variable length integer, so it only uses 1 byte for lengths 0 - 127, 2 bytes for 128 - 16383, etc. It's property and MIRI tested. Read more about the implementation: https://github.com/tomtomwombat/cold-string?tab=readme-ov-fi...
Any feedback welcome!