-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the offset parameter completely #175
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some haddocks for PS
and plusForeignPtr
would be good – the Internal
modules are public now as far as Haddock is concerned.
Feel free to bikeshed whether or not this is a major version bump.
Better safe than sorry, so +1 for a major bump.
@ekmett Could you add |
I have just tested with GHC. No regression and some test metrics (e.g. |
@hsyl20 No objection here. |
@hsyl20 this looks very promising! I'd still want to also see a run of the bytestring microbenchmarks |
I agree that it would be desirable to get results from Personally I don't feel that this PR should be blocked on such a longstanding issue. @hsyl20 Could you maybe reproduce the (most interesting) results from GHC in this thread? It's not obvious where to find them in the link that you shared. |
Metrics decrease for ARMv7 build:
Metrics decrease for i386 build:
Other tests don't exceed the thresholds. |
Benchmarks have been fixed in
The results look a bit ambiguous: some benchmarks are faster (up to 15-20%), some are slower for an unknown reason. Could someone else reproduce this result please? While synthetic benchmarks are ambiguous, I think it is fair to assign more weight to GHC metrics, provided by @hsyl20, as a measure of practical impact. Also the PR simplifies a lot of stuff and is aesthetically pleasing as well :) +1 for the major version bump. |
In #234 and #241 there have been a few comments that connect this PR with dropping support for GHC < 7.10 or GHC < 8.0. I don't really see why this PR would make that step necessary though. The IMHO it's quite acceptable that users of the |
I think the point is that if we drop support of obsolete GHCs, this PR can be merged as a minor version bump. I'm fine with either option or their combination :) |
In case anyone was wondering, I'm totally ok with changing the internal representation if other people are ok with it. Indeed I've always wanted to go further and change the representation to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This patch removes the offset parameter from the
ByteString
constructor, saving a word perByteString
and saving a ton of arithmetic.On GHC < 8.0 this does introduce a change in the representation offered by
Data.ByteString.Internal
.On GHC 8.0+ it provides a compatibility shim in the form of a pattern synonym that offers the existing behavior, so that even consumers of the
.Internal
API can continue to work unaffected.It has been tested back to GHC 7.0.
This is a breaking change to a .Internal module, in that, as users might expect that if they inject
PS fp ofs len
thenfp
andofs
will come back unmodified or that thePS
constructor is available (even on old GHCs).Feel free to bikeshed whether or not this is a major version bump.
The API for
Data.ByteString.Internal
is extended withfromForeignPtr0
andtoForeignPtr0
mimicing the use inData.Vector
, and also currently (re-)exportsplusForeignPtr
to make it available on older GHCs.It may be worth bikeshedding whether
Data.ByteString.Internal
should be exportingplusForeignPtr
, or if it belongs in an internal module.The
base
version bounds are currently unmolested, but this has not been tested on GHC 6.12.1.I have not been able to figure out how to run the
bytestring
benchmarks to see what if any improvements are provided by the code.