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
code optimization: deal with error first to prevent unnecessary computing #110372
Conversation
@lokichoggio: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hi @lokichoggio. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
@@ -359,6 +352,13 @@ func (pl *PodTopologySpread) Filter(ctx context.Context, cycleState *framework.C | |||
continue | |||
} | |||
|
|||
selfMatchNum := 0 |
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.
Better to add some explanations what this PR for. I guess you want to fail fast here, right?
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.
@lokichoggio It's weird to call it "fail fast". I guess you meant "move the definition of variables to their most recent usage"?
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.
em...... yes, fail fast
is a little weird, but I think the most valuable thing here is to prevent unnecessary computing when error in calculating minMatchNum
. Whatever, fail fast
is not that accurate.
/assign @Huang-Wei |
} | ||
|
||
pair := topologyPair{key: tpKey, value: tpVal} | ||
|
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.
nit: remove the blank line here.
Thanks @lokichoggio plz squash the commit. |
ok now |
/lgtm |
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.
Can you rename the tile to make it readable?
Yes, please describe the intention concisely. |
updated, thanks |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Huang-Wei, lokichoggio The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
optimize code under pkg/scheduler/framework/plugins/podtopologyspread
Special notes for your reviewer:
deal with error first to prevent unnecessary computing
move the definition of variables to their most recent usage
Does this PR introduce a user-facing change?