Re:Box to Save Memory in Rust
by kibwen on Monday April 27, 2026 @03:04AM
(#47918557)
SSO does have overhead. Firstly, on every access you have a branch. Secondly, and more severely, the "most general" umbrella type that all string methods are defined on is a string slice, and whereas conversion from `String` to `&str` is literally a no-op, SSO strings require work to be done to convert them to string slices. Furthermore, note that in the (surprisingly common) case where the string is zero-length, String already skips the allocation, same as an SSO string.
[ Parent
| on HN ]
There are no comments on this comment yet.