-
-
Notifications
You must be signed in to change notification settings - Fork 244
feat(preprod): make sure at least one app bundle is present for upload #2795
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
067013a
check for Info.plist inside app
trevor-e 9a1aa5a
lint
trevor-e 711543c
glob for all .app
trevor-e 1bde751
feat(preprod): make sure at least one app bundle is present for upload
trevor-e cc2cd1c
Merge branch 'master' into telkins/empty-products
trevor-e 654be79
lint
trevor-e File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
l: Here's a little tip to make this code more efficient:The difference is that, in your proposal, you are eagerly computing the filtered
app_paths, and you are allocating a whole vector to store all of them. Ifpathsis large, then this is potentially compute-inefficient and memory-inefficient.With my suggestion, you avoid eagerly computing the entire
app_paths. Instead, we only peek the first item, which means internally, the iterator only needs to compute and store the first value. Because iterators in Rust are lazy, we only compute the values as we iterate over them, saving ourselves a memory allocation, and potentially saving us from having to iterate all of thepaths, in the case where we detect an invalid XCArchive and exit early.I suspect the actual difference in performance is quite small here, but I want to highlight this, as
collectis an expensive operation (it iterates the entire iterator), and in general, we should defer callingcollectuntil as late as possible or avoid calling it entirely, as we do here.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.
I think eagerly collecting makes more sense in this case since
pathsis going to be small, <= 5 for basically 99.9% of apps we see. Working directly with the iterator like that makes the code too clever and less readable IMO, e.g. nowapp_pathshas to be mutable.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.
That's also fair, admittedly I did not know how many paths we typically expect. If it's smaller than the readability improvement from collecting is likely worth it