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 performance during uncached pod installation. #12154
Conversation
4a3b016
to
3da7eee
Compare
@@ -15,7 +15,7 @@ def initialize(root, specs_by_platform) | |||
# @return [void] | |||
# | |||
def clean! | |||
clean_paths.each { |path| FileUtils.rm_rf(path) } if root.exist? | |||
FileUtils.rm_rf(clean_paths) if root.exist? |
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.
optimization
@@ -51,8 +51,7 @@ def self.download( | |||
if target && result.location && target != result.location | |||
UI.message "Copying #{request.name} from `#{result.location}` to #{UI.path target}", '> ' do | |||
Cache.read_lock(result.location) do | |||
FileUtils.rm_rf target | |||
FileUtils.cp_r(result.location, target) | |||
FileUtils.cp_r(result.location, target, :remove_destination => true) |
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.
minor optimization
3da7eee
to
b1e250b
Compare
@paulb777 I checked Firebase can be installed which includes a prepare_command with this change. |
a3fb18f
to
93c35d6
Compare
63d1347
to
add1460
Compare
add1460
to
781c5b5
Compare
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.
Any specs for the new code path? Or are there already cases that cover this?
05ab212
to
940242c
Compare
we could add Firebase with a prepare command as an example to build and test. |
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.
Thanks! Any measurements of the speedup that you can share?
@paulb internally in a repo of ours that basically drove this change, we now see something that took a minute or two down to 15-20 seconds! |
940242c
to
4b2968f
Compare
Our internal repo basically offers 10s of pods and the repo has gotten larger which is now much faster to setup and correctly. |
@dnkoutso @justinseanmartin this change is busting cocoapods for me in some apps. Here's a gist of what I ran into :
|
Will take a look. |
When installing pods from a given repo, we are currently over-doing a bunch of unnecessary work by copying the original repo from within a temp dir N times as many pods we are installing from that repo. We then trim (clean) the copied repo to the files that are only relevant to the pod we are installing.
This can be very slow if a repo is large and offers multiple podspecs.
We also need to do this work only if there is a prepare command to run which currently operates or can operate against the initial cloned repo.
The PR here optimizes by splitting pods that require a
prepare_command
and ones that do not. For the ones that need one we execute the existing behavior but for the ones that do not, we trim the cloned repo and then copy exactly the files we need.This can speed up installation dramatically for repos that publish multiple podspecs.