Small string optimization (storing small strings inline instead of spilling to the heap) is something I'm pretty meh on. Many years ago I implemented it for all strings and vectors in Rust. The resulting code bloat was unbelievable.
-
-
Back when Rust built-in arrays were still variable-length I tried to implement a special case for zero-length arrays, assuming it to be a no-brainer win—and it made things slower. That still kind of informs my expectations around this kind of optimizations.
-
I may just have done something stupid, of course. Interesting to hear zero-length vectors are special-cased again.
- 3 more replies
New conversation -
-
-
You'd be surprised by the kind of realloc patterns that can be seen from IIRC Gtk+ when starting Firefox that come from small strings becoming increasingly larger and that would fit for the small string optimization. (at least that was the case 3+ years ago)
-
That said, while the small string optimization would help them, not doing the "increment this string size step by step" at all would be even better.
End of conversation
New conversation -
-
This Tweet is unavailable.
-
-
A silly question: why do string sizes satisfy power-law distribution?
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.