Open
Conversation
Bodigrim
reviewed
Sep 27, 2023
Contributor
Bodigrim
left a comment
There was a problem hiding this comment.
Seems largely fine with me, but I don't have time to compare Core. @sol could you please run benchmarks before and after? Ideally using https://github.com/Bodigrim/tasty-bench/blob/master/compare_benches.sh.
| unsafeTake, | ||
| unsafeTakeEnd, | ||
| unsafeDrop, | ||
| unsafeDropEnd, |
Contributor
There was a problem hiding this comment.
This module is publicly exposed, so please update changelog and provide @since annotations.
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.
Member
Author
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use
unsafeDropand friends instead of explicitly constructing values withData.ByteString.Internal.BS.INLINE.Underlying motivation:
Zero-copy conversion from
ByteStringtoTextand O(1) conversion fromTexttoByteStringoffer 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.