Refactor multiply operation for better performance in 2 Commands.Utility functions#14148
Conversation
|
@xtqqczze Not for the PR: could you please fix |
0.0358 ns vs 0.6288 ns small? It seems there are other places where we use the multiply. |
Large relative gain but small absolute gain (in micro-benchmark).
This PR replaces all instances of the |
See |
9a42619 to
154e218
Compare
|
How the measurements were done / results table in |
Using BenchmarkDotNet: Not the most realistic benchmark, but the results do show performance is not harmed by the changes. |
Address @iSazonov review.
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
@iSazonov Please could you approve changes. |
I did but since the PR changes code we need more reviewers. |
|
🎉 Handy links: |
PR Summary
Factor out multiply operation for slightly more readable code.
Replace all instances of
x * (y ? 1 : -1)withy ? x : -x.PR Context
As shown in following micro-benchmark results, these changes do not worsen performance, there is in fact a very small absolute gain.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.