-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Utilize ArrayPool for ECC calculations #519
Utilize ArrayPool for ECC calculations #519
Conversation
I don't know why these tests pass. EDIT: fixed now; generator polynomial is duplicated so the original doesn't change |
Just for fun, I've added another benchmark for a 2600-character QR code and compared this PR against v1.5.1. For these unreasonably-long QR codes, memory requirements have been reduced from 110 MB to 114 KB, a 99.9% reduction. And there's still room for improvement. Version 1.5.1
This PR
|
Co-authored-by: Günther Foidl <gue@korporal.at>
Thanks @gfoidl ! I'll merge in your suggestions here later tonight. |
Improves performance by calculating
generatorPolynom
only a single time and renting arrays fromArrayPool
. Basically I rewrotePolynom
to function similar toList<PolynomItem>
with methods such asAdd
,Clear
andSort
. It's a struct so it does not require a heap allocation itself (no change), and the underlying buffer is rented from the array pool. CallingDispose
on thePolynom
will return the array back to the array pool.Before
After - via ArrayPool.Shared
After - via custom array pool implementation (for use with .NET Framework)