Caching cocoapods directory does increase the build time

I am building a iOS project with a coocoapods dependency manager. The “dependency” section default commands include a “Fetch CocoaPods specs S3” and takes around 3 minutes.

I had an idea of optimalisation which would caching the .cocoapods folder to avoid fetching it from a S3 server.

So, I added a following lines:

dependencies:
  override:
  cache_directories:
    - "~/.cocoapods"

But this lead to increased build time:

“Machine” section -> Restore cache -> 3 minutes
"Dependencies" section -> Fetch CocoaPods specs -> 3 minutes
"Database" section -> Save cache -> 4 minutes

The questions:

  1. I have overrided the “dependencies” section, so why "Fetch CocoaPods specs is executed?
  2. I have cached .cocoapods folder with CocoaPods specs, so why the “Machine” section Restore cache takes so much time?
  3. Why the “Database” section takes so much time and if it’s possible to disable it once CocoaPods was cached.
1 Like