Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Checksum Support for ReadOnlySpan<byte> #841

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

Open
ds5678 wants to merge 1 commit into icsharpcode:master
base: master
Choose a base branch
Loading
from ds5678:checksum-span

Conversation

@ds5678
Copy link

@ds5678 ds5678 commented Aug 7, 2023

I added support for hashing byte spans. The only breaking change in my pull request is adding IChecksum.Update(ReadOnlySpan<byte>).

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

Copy link
Contributor

lahma commented Aug 13, 2023

Just a thought, as this is anyway breaking the interface and requiring new implementation. Would it make sense to only support Update(ReadOnlySpan<byte> buffer) and change this in new version (1.5?). This interface looks like something that not many rely upon directly.

Copy link
Author

ds5678 commented Aug 13, 2023

The interface is unimportant to me. I only changed it for completeness. Whatever the maintainers want is ok with me.

If breaking changes were being fully embraced, I would remove the array and array segment overloads. I assumed that binary compatibility was important to maintain, so I did not remove those.

lahma reacted with thumbs up emoji

Copy link
Contributor

lahma commented Aug 14, 2023
edited
Loading

Yes, it's maintainer's call, I think it already fails binary compatibility by adding a new method that old implementations don't implement.

Copy link
Author

ds5678 commented Aug 14, 2023

I think it already fails binary compatibility by adding a new method that old implementations don't implement.

This is true, and I said as such in my initial message, but it's a much smaller breaking change than removing a bunch of redundant methods.

Copy link
Member

piksel commented Aug 17, 2023

Yeah, avoiding breaking changes is one of the guiding principles for maintaining the library, and this PR currently lacks the motivation for the change.

It should be a fairly exotic use case for a consumer to implement their own CRC, so I think a breaking change could be acceptable here, but there needs to be a reason for doing so.

Copy link
Author

ds5678 commented Aug 17, 2023
edited
Loading

Motivation for the overall PR

It enables library users to reduce their allocations, resulting in significant performance gains.

Motivation for adding a span overload to the interface

Anyone not using the checksum classes directly, will not benefit from the performance gains of using spans.

Motivation for removing the redundant overloads

It simplifies the codebase and is a source-compatible change. If spans had been always been supported, these overloads would have never existed.

Copy link
Author

ds5678 commented Nov 6, 2023

@piksel What do you want me to do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /