Optimize allocations via ArrayPool/MemoryPool in Crc64HashAlgorithm.cs and other places #22617
Unanswered
Mrnikbobjeff
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Some places can benefit from using a memory arena. I explicitely tested this behaviour on the ComputeHashString implementation of Crc64HashAlgorithm.cs. I noticed that in this instance the benefit only materializes over repeated uses of the array pool. Furthermore, one can use a separate allocation strategy for small inputs where the value may be allocated on the stack in case of the CRC algorithm. I already benchmarked the difference, but instead of just publishin the change in one instance investigate other occurances where one would benefit from using the Memory/ArrayPool.
This is a recreation of a previous issue created with the wrong account
ConsoleApp2.CRC64_Benchmark-report-github.md
The benchmark shows that i reach approximately the same runtime as the original algorithm (I am 1% faster) but depending on the input size I allocate 3 orders of magnitude less than the naive version.
Public API Changes
none
Intended Use-Case
Reduced memory usage
Beta Was this translation helpful? Give feedback.
All reactions