Open hasufell opened 7 months ago
I guess most of the optimization tricks rely on the fact that we can walk and shift around buffers in ByteString and Text without copying any data (which is not true for ShortByteString).
So a ShortByteString API would likely just do fromShort
and toShort
at the outer layers? I could attempt a full ShortByteString implementation, but my guess is that it would be magnitudes slower due to more copying.
After writing my blog The ultimate guide to Haskell Strings I think the most sensible strategy is to:
Bytes
API from the byteslice package
O(1)
ShortText
support for free (conversion to Bytes
is O(1) too)
ShortByteString now has the same API as ByteString. It has certain benefits and is used in the new
OsPath
type.