-
Notifications
You must be signed in to change notification settings - Fork 822
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
Performance Tuning #658
Performance Tuning #658
Conversation
Based on the surrounding code it doesn't seem like full equality needs to be checked, so this feels like a pretty free win. I'd like @yonaskolb to validate that assumption though. @kateinoigakukun could you add a code comment explaining why we aren't using |
Also @kateinoigakukun just because I'm curious, I'd love if you could provide some before and after benchmarks. |
Hmmm, why CI triggered for push? It seems jobs for push are not triggered for other PRs. |
Yeah not sure. I re-ran it earlier to see if it would work. Might be a GitHub actions bug. We can merge without it. Later today I hope to review some of these PRs 👍 |
if !cachedGroup.children.contains(child) { | ||
cachedGroup.children.append(child) | ||
// Check equality by path because XcodeProj.PBXObject.== is very slow. | ||
if !cachedGroupChildren.contains(where: { $0.path == child.path }) { |
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.
This should be safe to do. Perhaps we can check for sourceTree
as well just in case the group has a different root.
While investigating performance issue, I found equality checking for
PBXObject
is very slow.So I changed to check only
path
property.cachedGroup.children
is called for each loop but it needs some computations every access https://github.com/tuist/XcodeProj/blob/368fb87695e5dbc09c6035ffdb873d4831f5e861/Sources/XcodeProj/Objects/Files/PBXGroup.swift#L11-L18This change make
getGroup
4.6 times faster than now in my project.