Google Play Store File-by-File Patching Reduces APK Szie by 65%

App Updates using File-by-File patching are, on average, 65% smaller than the full app, and in some cases more than 90% smaller.

Share online:

Android users are downloading tens of billions of new apps and games as well as frequent updates on Google Play involving a lot of data download—going forward you will be able to save this data, as Google is now reducing the size of App Updates by 65%.

To make this happen, Google is now using a new algorithm that has help them to reduce the size of app updates on average 65%. Earlier this year, the bsdiff algorithm (by Colin Percival) reduce the size by 47%, while the new "File-by-File" patching makes updated app 65% smaller than the full app.

However, there is one trade off with this approach i.e. "extra processing power is needed on the device." "On modern devices recompression can take a little over a second per megabyte and on older or less powerful devices it can be longer," Google writes. While the savings, "compared to previous approach, add up to 6 petabytes of user data saved per day," adds Google.

So does this work? With this approach, now when a users request an update, "Google Play will sends a patch that describes the differences between the old and new versions of the app," explains Google.

File-by-File first using bsdiff decompress both old and new files before computing the delta then apply the delta to the old uncompressed content and then recompress the new file. In doing so, "it make sure that the APK on device is a perfect byte for byte match, to the one on the Play Store."

And since deflate is based on zlib for almost all deflated content in the Play Store with default settings (level=6) and maximum compression settings (level=9) —this "makes it possible to uncompress the data, apply a patch, and then recompress the data back to exactly the same bytes," Google explained.

For now, this new patching is limited to auto-updates that take place in the background, usually at night—as it ensures users won't have to wait for an update to finish when manually updating an app. With this manual update will show different patch sizes.

Interested, head over to Archive Patcher GitHub project, to know more about File-by-File patching including the source code. And developer see these general tips on reducing APK size.

Watch how much the compressed text on the right side changes from a one-letter change in the uncompressed text on the left:

Google Play Store File-by-File Patching

Google Play Store File-by-File Patching

About The Author

Deepak Gupta is a IT & Web Consultant. He is the founder and CEO of diTii.com & DIT Technologies, where he’s engaged in providing Technology Consultancy, Design and Development of Desktop, Web and Mobile applications using various tools and softwares. Sign-up for the Email for daily updates. Google+ Profile.