-
Notifications
You must be signed in to change notification settings - Fork 999
Speed up crc32 calculations subclassing crcproxy #319
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
Speed up crc32 calculations subclassing crcproxy #319
Conversation
syncing fork with original repository
|
I've made some updates to this pull request so that there are no longer any conflicts with the base branch. I've also fixed some of the issues codacy found a while ago. |
| throw new ArgumentNullException(nameof(buffer)); | ||
| } | ||
|
|
||
| Update(new ArraySegment<byte>(buffer, 0, buffer.Length)); |
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.
Pretty trivial, but just in case it's worth mentioning - is it worth creating an ArraySegment if the version of Update that takes an ArraySegment immediately unwraps it back into an array anyway?
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.
I did some benchmarks directly calling Proxy.Append, instead of calling the other version of Update. Unfortunately I did not see any speed benefit. But I do think the code is a bit inconsistent, there are 2 Update methods where Proxy.Append is called directly, then there is a 3rd Update method that calls one of the other 2 Update methods.
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.
I suppose that handling these sort of differences in where Span and friends can be useful, though I guess the extra dependency they have in versions of .Net prior to the latest would be unwanted?
|
See #306 |
This PR offers basically the same change as my last one (#318), but the implementation is slightly different, using subclassing instead of Func<>'s
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.