News for hackers. Stuff that matters.
Re:Small Strings in Rust: smolstr vs. smartstring by Dylan16807 on Sunday August 25, 2024 @09:18AM (#41347089)
> It's quite possible to make the small string buffer larger, but that comes at the cost of the large string representation taking up more space than necessary on the stack. IIRC libstdc++ does this, which makes its std::string take up 32 bytes on the stack.

Though to follow through on that, 24 bytes is also more than necessary. You don't have to be very clever to shrink your string size to 16 bytes (6 for the pointer, 6 for the size, 4 to store either capacity or spare capacity as floating point).

Re:Small Strings in Rust: smolstr vs. smartstring by aw1621107 on Sunday August 25, 2024 @12:31PM (#41348612)
True, though as always that comes with tradeoffs of its own.