Add microbenchmarks for Crc32 and Crc64 algorithms#3035
Add microbenchmarks for Crc32 and Crc64 algorithms#3035cincuranet merged 3 commits intodotnet:mainfrom
Conversation
|
Here are the CRC benchmarks per your request. I do see an execution failure in one case in CI, but my attempts to make sense of it have hit a dead end. I don't think it's related to this change, but can't be certain. |
|
Yea, it's not your change, some fragility in a winforms test. |
adamsitnik
left a comment
There was a problem hiding this comment.
@brantburnett thank you for your contribution! Overall it looks good, but PTAL at my comments.
src/benchmarks/micro/libraries/System.IO.Hashing/CrcAppendTests.cs
Outdated
Show resolved
Hide resolved
src/benchmarks/micro/libraries/System.IO.Hashing/Crc64AppendTests.cs
Outdated
Show resolved
Hide resolved
src/benchmarks/micro/libraries/System.IO.Hashing/Crc32AppendTests.cs
Outdated
Show resolved
Hide resolved
| { | ||
| Crc.Append(Buffer); | ||
| } | ||
| } |
There was a problem hiding this comment.
Would you mind adding benchmarks for other methods? Like [GetCurrentHash()](https://learn.microsoft.com/en-us/dotnet/api/system.io.hashing.noncryptographichashalgorithm.getcurrenthash?view=dotnet-plat-ext-7.0#system-io-hashing-noncryptographichashalgorithm-getcurrenthash(system-span((system-byte)))) for example?
There was a problem hiding this comment.
I added a test for GetCurrentHash. I didn't think any of the other methods warrant benchmarks, except possibly GetCurrentHashAsUInt32 or HashToUInt32. However, both of those are only available on the .NET 8 packages.
I did use separate classes for the GetCurrentHash tests because they don't need to run on different data lengths.
adamsitnik
left a comment
There was a problem hiding this comment.
@brantburnett thank you for your contribution! Overall it looks good, but PTAL at my comments.
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
|
@adamsitnik is there anything that prevents this from merging? |
|
I'm going to merge this as it is now and add the remaining benchmarks myself in separate PR. |
See dotnet/runtime#86539 (comment)