Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CocoaPods: How do I get the binary size of each pods I linked to?

Currently my project relies on many pods, adding pods makes my binary bigger, I'd like to inspect the pods I linked to and see which of them is the biggest, so that I could know which of them I should remove.

Any Idea?

Thanks.

like image 316
CarmeloS Avatar asked Jun 17 '15 03:06

CarmeloS


People also ask

What does ~> mean in CocoaPods?

~> (the optimistic operator) is used when you want to specify a version 'up to next major | minor | patch'. For example: ~> 0.1.2 will get you a version up to 0.2 (but not including 0.2 and higher)


2 Answers

First, go to your root directory (the directory with yourproject.xcworkspace) and type "cat Podfile". This isn't completely necessary, but will show you the dependencies, just so you have an idea.

Then type "cd Pods". This will bring you to the directory where the dependencies are stored. Next, type "du -h". This lists the size of each directory, and will give you a pretty good idea which pods are the largest.

like image 137
Jack BeNimble Avatar answered Sep 20 '22 18:09

Jack BeNimble


you can use this tool from Google https://github.com/google/cocoapods-size

It gives you how much byte a specific pod's binary add to your binary.

It basically uses an empty app and does the before/after comparaison

Exemple:

./measure_cocoapod_size.py --cocoapods AFNetworking

// Output:
Size comes out to be 231568 bytes (measured at version 3.2.1)

You can even pass custom sources, or use the diff yourself on your app ;)

like image 38
Paul Aigueperse Avatar answered Sep 20 '22 18:09

Paul Aigueperse