bytestring
bytestring copied to clipboard
Remove code duplication
Use unsafeDrop
and friends instead of explicitly constructing values with Data.ByteString.Internal.BS
.
- All those primitives are marked with
INLINE
. - This does not change the generated core.
Underlying motivation:
Zero-copy conversion from ByteString
to Text
and O(1) conversion from Text
to ByteString
offer substantial benefits. Despite #193 being closed, I still think it's desirable that the code makes it easier to experiment with different underlying representations. If at the same time, this reduces code duplication and makes the code easier to read, then the better.
I only looked at construction sites for now. There are more low hanging fruit, but before tackling those I want to make sure that we are on the same page.