5 ms·
> then what's the point? There's no point. Moreover, passing the length separately is annoying and error-prone. You can have both your models in a single type
by alcover 4y ago
> then what's the point?
There's no point. Moreover, passing the length separately is annoying and error-prone.
You can have both your models in a single type. That's what my buffer lib achieves : SSO + slicing.
https://github.com/alcover/buffet https://github.com/alcover/buffet
- morelisp 4y agoIt’s clever and probably makes sense in some contexts but 24b overhead not counting the store feels like a nonstarter for many cases.
- alcover 4y agoYou'd help me by explaining those cases. I'm not connected to the 'industry'. Also some major impl are 24 or even 32 bytes. With a generous SSO you catch a lot of strings w/o overhead.
- morelisp 4y agoI'm not aware of any common string implementation that takes 3-4 words just to put an empty string in your struct especially if it also still requires external allocation with additional size words once the string gets above a certain size. Java takes 1, Go takes 2, SDS takes 1, libstdc++ takes 3 but doesn't require an external store later, etc.