15

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.

CarmeloS
  • 7,868
  • 8
  • 56
  • 103

3 Answers3

12

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.

Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213
  • 8
    Well, I'd like to know the compiled binary size of pods, not source file size. – CarmeloS Jun 17 '15 at 03:27
  • 1
    Ah, right. That might be a bit trickier, since (I think) the source files are combined into the same binary. One idea might be create a simple app that only calls just the binary and get the size of the generated archive. Another would be to comment out the calls to a given library in your app and measure the size of the archive before and after. – Jack BeNimble Jun 17 '15 at 12:26
  • 3
    Why doesn't Cocoapods just list the pod size on their site? Size seems super useful to know before bundling an SDK into your app; however, I can't find that info anywhere on the Cocoapods site as [seen here](https://cocoapods.org/pods/GoogleAnalytics). Any thoughts? – Brantley Beaird Jun 06 '17 at 17:05
5

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 ;)

Paul Aigueperse
  • 299
  • 3
  • 14
1

When you build a project all your pods are built too. Usually(but not always) their location is the same as your final binary[Build location]. You will see how many space it takes on build machine

Also you can find it inside final consumer if you add dependency as dynamic[About]. You will see how many space it takes on device. In this case it will be smaller because doesn't include additional files

yoAlex5
  • 29,217
  • 8
  • 193
  • 205