Samarth Gupta | November 14, 2023 | 4 min read
How we increased our Zomato Restaurant Partner App speed by over 90%

At Zomato, we understand that the success of our platform hinges on delivering outstanding service to our customers, restaurant partners and delivery partners. To achieve this, we embarked on a transformative Android engineering journey with our Zomato Restaurant Partner App, focusing on optimizing performance, enhancing the overall user experience, and bolstering app stability. 

We are deeply committed to providing a seamless experience through our restaurant partner app, that enables our restaurant partners to efficiently handle incoming orders, streamline operations and have an elevated user experience with Zomato.

Here’s everything that we did –

We applied a straightforward rule to examine our overheads. Our assessment of solutions was centered around their return on investment and the level of effort demanded from our engineering team. With these criteria as our guiding principles, we began a significant journey of improvement, categorizing our work into 7 key areas:

1. Initial Load Time of the App:

In the world of Android development, ensuring a swift and seamless initial load time is paramount. Users expect apps to launch quickly and be responsive from the moment they tap the app launch icon. Achieving this requires a deep understanding of the platform and the various components that come into play during the app startup. One crucial element in this process is the Application class. 

The Application class in Android serves as a base class for maintaining global application state and is instantiated before any other component when an app starts. It provides a centralized location for initializing and managing resources and state that need to be accessible throughout the entire app’s lifecycle.

Subclassing an Application is generally unnecessary. However, in the context of a substantial codebase and numerous teams crafting user experiences within the same app, it is not uncommon to overlook this fundamental principle. In such complex environments, maintaining simplicity can be challenging. Nevertheless, adhering to this principle remains crucial for codebase coherence and streamlined development. It ensures that changes and enhancements are implemented efficiently, benefiting the entire team and app ecosystem.

2. Defer initializations:

We removed several non-critical feature configurations/ 3rd party SDKs initializations from the main thread execution and managed to defer them as per the requirements within our app, allowing for dynamic delivery when needed.

3. Making use of the ExecutorService

We assessed ways to prevent other background apps from utilizing a core during our setup process and leveraged the ExecutorService to cache threads within a pool. These threads are assigned maximum priority, ensuring that the device prioritizes tasks related to our startup process, optimizing overall efficiency.

4. Eliminating Unnecessary Delays in Splash Screens:

We examined and optimized the actions performed during this phase. Upon walking through our code, we found multiple delays and time taking configuration operations which could’ve been avoided and/or cached based on our requirements. We eliminated these delays on the splash screen, and achieved a significant reduction in the overall time required for the app to become operational.

5. Enhancing Rendering Performance: 

We knew that optimizing how our app displays lists of items was crucial. To do so, we utilized RecyclerView prefetching, which works by preloading items in a list that are anticipated to become visible soon, enhancing the overall app performance. It involves asynchronous loading of items that are not yet on the screen but are likely to be scrolled into view. 

Since the UI Thread does not do any work in the gap between frames, we were able to use that idle time to get work done that we will need later.

This image has an empty alt attribute; its file name is image3.png

We also made use of ViewStub which is a nifty feature utilized to enhance our app’s performance. It allowed us to delay the inflation of complex or resource-intensive layouts until they were actually needed on the screen. This deferred loading conserved resources and memory, and eventually led to faster initial app launch times and smoother interactions.

6. Profiling:

Android Studio offers profiler, a robust tool for monitoring CPU activity, memory usage, and trace analysis similar to Perfetto. It allowed us to perform a detailed examination of the app’s operations. As we assessed our app, we identified inefficiencies in our views and memory utilization. Consequently, we embarked on enhancing our caching mechanism and maximizing view reuse wherever feasible.

7. Memory Leaks: 

We integrated LeakCanary into our app to tackle all the quirky memory leaks, as they can lead to sluggish rendering and even ANRs (Application Not Responding) in the app, impacting user experience.

By implementing all the optimizations, our cold start times plummeted from 27% in February to an impressive 1.4%. Furthermore, we slashed frozen frame occurrences from 3.72% to 1.99%. With this monumental improvement, restaurant partners now enjoy lightning-fast access to critical information. Orders, menu updates, customer feedback, and other essential data are at their fingertips almost instantly, regardless of their network conditions. 

This reduction in load time has not only benefited restaurant partners but has also translated into an exceptional user experience for customers. Orders are actioned upon more quickly, and delivery times are reduced, all contributing to higher customer satisfaction and loyalty. As a result, in about 4 months, our app rating on the Google Play Store went from 4.1 to 4.8!

The Pursuit of Excellence Continues

Our relentless pursuit of excellence finds its manifestations in the enhancements we’ve achieved for the Zomato Restaurant Partner App so far. Through deep analysis, strategic optimizations, and an unwavering commitment to delivering the best possible experience, we’ve not only achieved tangible improvements but also fortified the app’s technical quality. As we forge ahead, we remain dedicated to refining and enhancing the app, solidifying our position as a trusted partner for the restaurant partners countrywide.
Android Engineering Team (Zomato Restaurant Partner)

facebooklinkedintwitter

More for you to read

Technology

zomatos-journey-to-seamless-ios-code-sharing-and-distribution
Inder Deep Singh | June 6, 2024 | 15 min read
Unlocking Innovation: Zomato’s journey to seamless iOS code sharing & distribution with Swift Package Manager

Read more to know about how we migrated Zomato’s 10-year-old iOS codebase to Apple’s Swift Package Manager. The blog highlights the process behind building a central syncing mechanism needed across multiple apps, the challenges encountered, and how we resolved them.

Technology

menu-score-how-we-cracked-the-menu-code-and-you-can-too
Keshav Lohia | April 18, 2024 | 2 min read
Menu Score: How we cracked the Menu Code (and you can too!)

Menu score empowers our restaurant partners to build exceptional and delightful food ordering menus. Read on to know more about how this simple tool helps restaurant partners grow their business.

Technology

hackoween-elevating-cybersecurity-resilience-at-zomato-through-competitive-challenges
Security Team | April 16, 2024 | 6 min read
Hackoween: Elevating cybersecurity resilience at Zomato through competitive challenges

Read more about how we are strengthening cybersecurity and promoting a security-first approach for our engineering team.

Technology

a-tale-of-scale-behind-the-scenes-at-zomato-tech-for-nye-2023
Zomato Engineering | February 29, 2024 | 6 min read
A Tale of Scale: Behind the Scenes at Zomato Tech for NYE 2023

A deep-dive into how Zomato handled the massive order volumes on New Year’s Eve. More than 3 million orders delivered in a single day!