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.
-
Show this thread
-
Replying to @pcwalton
yeah, just from looking at what the generated code does when reversing C++, it feels pretty sketchy- "get pointer to string contents" is now a branch, and one that can be unpredictable anytime you have varying string lengths (not uncommon, I suspect!)
1 reply 0 retweets 5 likes -
Replying to @XMPPwocky
I wouldn't be surprised if the benchmarks to justify the optimization were done long ago on slow mallocs like that of msvcrt, and nobody bothered to test again now that we have fast mallocs like jemalloc.
1 reply 0 retweets 11 likes -
Replying to @pcwalton @XMPPwocky
Swift does SSO I believe, and they're fairly recent, with the opportunity to learn from Rust... I'd be surprised if they didn't benchmark first (but don't actually know). I'd be curious what their results were if they did.
1 reply 0 retweets 1 like
Note that macOS libSystem malloc is fairly slow compared to jemalloc in my experience.
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.