-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Refactor multiply operation for better performance in 2 Commands.Utility functions #14148
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
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. |
src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs
Outdated
Show resolved
Hide resolved
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. |
anmenaga
left a comment
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.
LGTM
|
🎉 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.