News for hackers. Stuff that matters.
Re:Small Strings in Rust: smolstr vs. smartstring by tomcam on Sunday August 25, 2024 @12:17AM (#41344348)
Oh! So the string itself is still on the heap? I assumed it was all on the stack.
Re:Small Strings in Rust: smolstr vs. smartstring by super_flanker on Sunday August 25, 2024 @12:48AM (#41344467)
No, let me try to explain differently. If `compact_str` was not used, then your normal `String` would take 24 bytes of stack space (regardless of the string size) + heap space. What `compact_str` is trying to do is not use heap when string content is less than 24.
Re:Small Strings in Rust: smolstr vs. smartstring by tomcam on Sunday August 25, 2024 @01:45AM (#41344724)
Thank you. That aligns with what I originally thought.