Why is our app twice as large as what we submitted? “Contagious zeros”

iTunes App Store

As you probably know, Apple has an app download limit for users downloading over 3G. Up until recently, this limit was 10 MB. If your app's file size exceeds the limit, users attempting to download it over 3G receive an error and must try again later over wifi. Needless to say, this can lead to frustrated users and lost sales and if you can get your app under this limit, it's definitely worth the effort.

So, when we submitted our latest update of Pig Rush to Apple for review, we worked hard to get it under the (then) 10 MB 3G app download limit.

Eventually, we got the file size down to 8.9 MB, knocking a massive 66% off of the original file size. Awesome!

We then submitted our update to Apple for review. Amazingly, only 12.5 hours later it was approved and live on the App Store. Excellent!

Then we noticed the file size listed in the App Store… 16.5 MB.

How could this be? This was nearly double the size of what what we submitted!

We downloaded the compressed package from the app store, and compared it to the version we uploaded. Sure enough, the version on the App Store was larger: 17.4 MB vs. our 8.9 MB version.

We extracted both files to compare, but apart from some standard config files added everything was the same.

Upon further inspection, it turned out there was one big difference: the main executable was 13.7 MB in both versions. However, the App Store version of this file compressed to 12.4 MB while ours compressed to 4 MB.

That's a pretty significant difference. We decided to ask Apple about this, and here's the answer we got:

"When your application is delivered to Apple, it is encrypted for DRM purposes and re-compressed. When the encryption is added, the size of the compressed file will increase. The exact size of the increase will vary from app to app, however, the size increase can be large when the binary has a lot of contagious zeros in it. We are unable to guarantee the size of your file after the encryption has been added."

File size increasing after encryption is added makes sense - but an increase from 4 MB to 13.7 MB seems extremely high. I've also never heard of "contagious zeros" before, and it looks like I'm not the only one.

Luckily, the new 3G limit has been upped to 20 MB so we still fall under it, but I'd still be interested in hearing others' experiences in final app package size vs. what was uploaded. Also, if you have any suggestions on limiting the number of contagious zeros in your binaries, please let us know.


  1. Simon | February 24th, 2010

    Surley they meant contiguous? Spellcheck error?

  2. cmh | February 24th, 2010

    this is likely because ciphertexts are relatively incompressible

    in keeping with this, “contagious zeroes” is probably a typo; what the person probably meant is “contiguous zeroes”, which would compress well, but such blocks of easily compressible data would obviously disappear in the ciphertext

  3. Stephen Stephen Ceresia | February 24th, 2010

    @Simon: Yes, most likely. Still, very surprising to see such a difference in size from what we submitted.

  4. Steve | February 24th, 2010

    Apple are doing this the wrong way round. They encrypt, then compress. The encrypted file will never compress well. If they were to compress, then encrypt, everything would be fine.

  5. kraw | February 24th, 2010

    Yes, that would compress well, but it would defeat the point of the encryption. Apple is doing this correctly (unless you consider the option of not encrypting the executable).

  6. Pepe | February 24th, 2010

    I can help you here in Chile to talk about this “contagious zeros”. Send me (via Fluxa) the spanish version of this story and I will contact Fayer Wayer (one of the top geeky websites in LatAmerica) and maybe La Tercera (Big Newspaper).
    Best regards,
    Jose Francisco Hurtado
    Journalist and part time Hero

  7. Andrew | February 25th, 2010

    FYI, the gray text of the quote is completely unreadable against the gray background on an iPhone screen. Not hard to read, invisible.

  8. Todd Cullen Todd Cullen | February 25th, 2010

    @Andrew – thanks for letting us know. We’re taking a look at a couple mobile themes for WP to fix the problem.

  9. Clarke | August 30th, 2010

    Curious how to reduce the contiguous zeros… we have run into this same situation, but not clear from Apple how to fix. Any advice?


  10. Andre | January 11th, 2012

    And now your app has size 47.9 MB ;)))

  11. Pingback: iOS App file size in ad-hoc distribution is still large compared to before optimization | Technology & Programming

Post a Comment