Our Android app has been eating but shedding weight

Zomato
Zomato
Sep 10, 2019 · 4 min read

By Arnav Gupta

This post was originally published on Zomato Blog on June 2, 2019.

At Zomato, we never judge your eating habits. Whether it’s Biryani or Salads, we have everything you love! But unfortunately, people have been fat-shaming our android app for a while. Not cool — so we decided to do something about it.

Space on your phones, and the data you consume are both important for us, and we have taken steps so that our app sheds some weight and also sticks to better eating habits.

A few months back, our app was 23MB to download from the Play Store and for many of our long-time users, had cache sizes going up to 600–700MB. All that is a thing of the past. This is where we are at right now –

  • App download size from Play Store = 15~16MB
  • App cache size = limited to 120MB
  • Ordering home screen scroll consumes 60–70% less bandwidth

And no, we did not stop adding new features to our app during this time. We continued to add new features, while we were reducing the size of the app. Some notable additions in the last couple of months were —

  • A brand new flow for adding your location
  • Zomato Premier League — which we are sure you had a great time participating in (Play Zomato Cricket Cup if you’re missing ZPL!)
Our new location flow on Android and iOS

How did we manage this?

Apk Size Reduction

As you might have read in our last update, our build time optimization efforts also made it possible to make app bundles. This directly resulted in up to 22% reduction in app download size.

We also converted all PNG files to WebP wherever it was much smaller. We noticed, especially for blurred photos (like the ones used in backgrounds, splashscreens), WebP assets are almost 10x smaller than PNG.

Also, we donned our janitor hats and cleaned up all unused resources (images, layouts, strings).

The majority of the reduction happened via the above two steps, but in this period we also removed a net 300,000 lines of code, and removed 4 libraries we use in the app.

Sometimes when you look back at your codebase, especially if it is 8 years old, you find not just functions or files, but entire modules that are completely unused, and sometimes even dangerously — “seems unused”. 😅

The mobile platform team at Zomato thought of taking up this task of removing as much code from the app as possible, without reducing any functionality or feature.

Thus, in the last 2 months, the contributions of the mobile platform team has been a net negative number of lines of code to the app codebase.

Cache Limits

We did extensive testing and figured that 100mb of cache is sufficient for us to quickly load the order home page (restaurants around you) thumbnails. For a food ordering app, it is unjust to ask for more than 100MB of space from your device. Also, the way we loaded fonts and other assets often led to the creation of zombie temp files, that were unused but piled up in the cache. We fixed all of that, and now you will never see the Zomato app having more than 120MB of cache.

Order Homepage Bandwidth Conservation

When you scroll through the list of restaurants for ordering, the thumbnails that are shown on the left were downloaded of 675×675 pixels.

We now calculate the exact size that is needed (this differs from phone to phone and also depends on screen density), and fetch only that size.

So you can scroll through our endless list of restaurants, without worrying about your data pack now.

Lesser the code, lesser the bugs. The Platform team at Zomato lives by this quote

If you are an Android engineer who loves challenges and is keen on working with Zomato, do check this out.

Zomato Technology

This space is for sharing what we’ve learnt, insights we’ve garnered and the inspiration behind our developments in Engineering, Design and Product

Zomato

Written by

Zomato

Better food for more people.

Zomato Technology

This space is for sharing what we’ve learnt, insights we’ve garnered and the inspiration behind our developments in Engineering, Design and Product

More From Medium

More on Zomato from Zomato Technology

More on Zomato from Zomato Technology

[India] Call for feedback — Restaurant Ratings v2

23

More on Engineering from Zomato Technology

More on Engineering from Zomato Technology

The Deep Tech Behind Estimating Food Preparation Time

44

More on Zomato from Zomato Technology

More on Zomato from Zomato Technology

All new Search and Discovery on Zomato

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade