Skip to content
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

Optimize handleObjects method #134

Conversation

clyang82
Copy link
Contributor

It seems we do not need to call getMapping or unmarshalFromJSON for the ObjectDefinition in a loop of relevantNamespaces. Nothing changes in the loop. So move it in the upper level to reduce the cpu and memory consumption.

@clyang82 clyang82 force-pushed the optimize_handleObjects branch 3 times, most recently from 04636ba to 2d4db2e Compare May 25, 2023 14:41
@clyang82
Copy link
Contributor Author

/assign @mprahl


unstruct, err := unmarshalFromJSON(objectT.ObjectDefinition.Raw)
if err != nil {
os.Exit(1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you didn't write this code but could you please change this to a panic instead?

@mprahl
Copy link
Member

mprahl commented May 25, 2023

Nice optimization @clyang82 . Just a minor comment to address.

@dhaiducek
Copy link
Member

This a minor but impactful change--thanks, @clyang82!

Signed-off-by: clyang82 <chuyang@redhat.com>
@openshift-ci openshift-ci bot added the lgtm label Jun 1, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 1, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clyang82, mprahl

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants