-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Extract loop constant from makeResIds.go's PrevIds for performance improvement #4790
Comments
/triage accepted |
@natasha41575: GuidelinesPlease ensure that the issue body includes answers to the following questions:
For more details on the requirements of such an issue, please see here and ensure that they are met. If this request no longer meets these requirements, the label can be removed In response to this:
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. |
I can try creating a PR for this. Want to run my own performance testing but thanks @ephesused for finding this! |
@caproven Feel free to assign this issue to yourself (you can leave a comment with |
Thanks @natasha41575 /assign |
I can confirm that @ephesused was on to something, excellent find! Below are some performance findings of mine based on a large set of manifests whose total output is ~70k lines with heavy patchTransformer usage, run on a Ryzen 5 5600x. Before:
After:
|
I think I see a way to improve further. Starting with the above fix, I have a complex run that executes in about 300s. I can get that down to about 220s by adjusting the PrevIds's GetMeta call so that it tells GetMeta to populate only what PrevIds needs: the APIVersion. The hack I'm testing allows callers to restrict the set of fields that GetMeta populates. Currently GetMeta always populates everything. With the number of calls we're seeing for complex runs, that full population for PrevIds is fairly expensive (and carries no benefit). Perhaps this sort of adjustment is in line with the intent of the "// TODO: consider optimizing this parsing" comment in GetMeta. I'll open a separate issue once I've got this baked a little more. I'll use that issue as my primer to be a contributor. Edited for grammar/typos |
Describe the bug
https://github.com/kubernetes-sigs/kustomize/blob/0fa010c/api/internal/utils/makeResIds.go#L53-L57 makes somewhat heavy calls, but it is a loop constant. Moving the constant out of the loop can yield a significant performance improvement.
Apologies for the lack of a PR. I haven't gotten myself set up properly yet, and figured I'd send this along in an issue since it's a simple adjustment.
makeResIds.patch.txt
Comparison
Kustomize version
v4.5.7
Platform
linux
The text was updated successfully, but these errors were encountered: