save_cache in parallel



I have been trying to apply all performance tips I have found in CircleCI, but one thing I see that can be improved is save_cache step.


Most of people do in their dependencies job:

1) Restore cache

2) Do things

3) Save cache


When people has only 1 save_cache its fine, but for projects like React Native for example, a good practice is to have separate caches for Yarn. RubyGems and CocoaPods, so you end having 3 save_cache at the end of the job.


For example

1) Restore caches

2) Do things

3) save_cache Yarn 2min

4) save_cache Ruby 30 segs

5) save_cache CocoaPods 30 segs


Now the total time of the job is: 2m + 30s + 30s = 3m


If CircleCI would execute all save_cache in parallel and wait until last one has finished to finish job, the time would be 2min, saving a 33% time in this example.


I think they are independent jobs that dont interfere in each other, as far as I know, it creates a zip and uploads to S3. So they could be made in paralle.



Hope you like this idea!!

Many thanks for your time. Have a nice day :-)

  • Guest
  • Feb 6 2020
  • New
  • and 4 more