bytestring icon indicating copy to clipboard operation
bytestring copied to clipboard

Remove code duplication

Open sol opened this issue 11 months ago • 1 comments

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.

sol avatar Sep 27 '23 05:09 sol