-
-
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
Performance improvements #509
Conversation
FYI, I have not yet gone back through all my changes to add comments and perform a self-review, etc. |
By the way, I plan to attempt using ArrayPool for further optimizations but not in this PR. |
@codebude I think this PR has enough changes. The GitHub comparison should be reasonable enough to follow. I would like to follow up with some other PRs:
|
The benchmarks are updated in the PR description, showing 60-75% memory reduction and 100-400% speed increase. Notably, Gen1 collections have been reduced enough that BenchmarkDotNet has stopped listing them! Most likely further PRs will further reduce memory requirements, but not increase speed. |
I'm not planning to re-engineer the mathematics, like to use vector math or anything. While I'm sure it's possible, that's not my forte. |
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
Co-authored-by: Günther Foidl <gue@korporal.at>
@gfoidl Thanks for the review! I merged as many of them as I could via GitHub.com, and I'll need to spend a little more time integrating the rest of your comments. |
@gfoidl Thank you very much for your commitment. This is really a top-level review! Great! |
Benchmarks updated. New test results shaved 10us (10%) from short test and 20us (1%) from long test. |
Eliminating |
But memory usage improved massively. :-) |
While all beneficial changes, the memory usage didn't change due to the arithmetic/ref/pointer changes; it measured as identical. The memory usage changes were due to |
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.
A few nits, otherwise LGTM 👍🏻
System
Before
After
Notes
Most of the performance improvements in this PR fall into a few categories:
BitArray
instead ofstring
AddRange
)Progress
So far about half the code has been converted to use
BitArray
. There is still a notable amount of code that still uses strings that remains to be optimized. Also thePolynom
class/constructor is heavily used and should be optimized.