Mobile Development

Grab optimizes Southeast Asia’s leading superapp performance through R8 and advanced compiler strategies

Grab, the dominant superapp platform across Southeast Asia, has successfully navigated a complex technical transformation to overhaul its massive Android infrastructure. With a codebase spanning more than a decade and encompassing over 10 million lines of code, the company faced a compounding crisis of performance: increasing App Not Responding (ANR) rates, bloated installation sizes, and sluggish startup times. By integrating advanced compiler optimizations, including R8 and Baseline Profiles, the engineering team achieved a 32.5% reduction in user-perceived ANRs, a 30.4% decrease in download size, and a 35% improvement in cold start speeds. This transition serves as a critical case study for managing technical debt in hyper-growth mobile applications.

The Technical Debt of a Superapp

Grab functions as an ecosystem, offering mobility, delivery, and financial services under a single digital roof. However, the architecture required to support such a vast array of services inherently creates technical friction. Over ten years, the accumulation of legacy code, hundreds of third-party libraries, and the complexities of a hybrid Bazel and Gradle build system created a "perfect storm" of performance degradation.

The primary bottleneck identified by the Passenger App Core team was the overhead associated with the Android Runtime (ART). During app initialization, the system was forced to process a massive number of DEX (Dalvik Executable) files. This resulted in significant cold start delays and high ANR rates, particularly immediately following new app releases. Because standard Google Play Cloud Profiles could not cover all of the initialization paths unique to Grab’s custom dependency graphs—such as the initialization of Dagger modules—the application remained reliant on Just-In-Time (JIT) compilation and delayed background optimizations, which left users with a degraded experience during the first few days post-update.

Grab Reduces ANRs by 32% and improves startup time by 35% with R8 and Profile guided optimization | Android Developers' Blog

A Chronology of Optimization

The optimization strategy was executed in three distinct phases, spanning from 2025 to 2026. This deliberate, phased approach allowed the engineering team to isolate the impact of specific compiler configurations while minimizing the risk of breaking critical application features.

Phase 1: The R8 Optimizer (2025)
The initial phase focused on moving away from the aging Proguard configuration in favor of the more robust R8 optimizer. By adopting proguard-android-optimize.txt, the team enabled aggressive shrinking and optimization. This phase was paired with the implementation of custom Baseline Profiles and Startup Profiles. By defining critical user journeys and ensuring they were pre-compiled into machine code upon installation, the team saw an immediate 25% drop in ANR rates and a 27% gain in cold start efficiency.

Phase 2: Transitioning to R8 Full Mode (2026)
Nine months after the initial rollout, the team shifted the entire codebase to "R8 Full Mode." This move enabled deeper cross-module optimizations that were previously unreachable. The migration was not without challenges; the team had to address complex issues involving Java dynamic proxies and JSON parsing libraries like Gson. By isolating code paths that relied on reflection—which R8 would otherwise inadvertently strip or rename—and applying targeted "keep rules," the team maintained application stability while further shrinking the binary size by 14%.

Phase 3: Keep-Rule Refinement and Governance
The final phase shifted from reactive fixing to proactive governance. Recognizing that "keep rules"—instructions that tell the compiler which parts of the code to preserve—often bloat over time, the team integrated the R8 Configuration Analyzer into their CI/CD workflow. This allowed them to identify redundant rules, resulting in an additional 3.6% reduction in app size and ensuring that the performance gains achieved in previous phases were not eroded by future development.

Grab Reduces ANRs by 32% and improves startup time by 35% with R8 and Profile guided optimization | Android Developers' Blog

Data-Driven Performance Gains

The impact of these technical changes is quantified in the following performance metrics:

Metric Category Improvement
Total ANR Reduction ~32.5%
Total Size Reduction ~30.4%
Cold Start Improvement ~35%

Beyond these raw numbers, the team utilized a custom internal tool, app-sizer, to track the "cost" of every line of code. This metric provided a granular view of how effectively the R8 compiler reduced the memory and storage footprint of new features. In an era where AI-assisted coding is drastically increasing the volume of code produced, these optimizations provide a necessary buffer, ensuring that the app remains performant even as it grows in functionality.

The Role of CI/CD Guardrails

A significant component of the project’s success was the introduction of automated pre-merge guardrails. In the past, developers could inadvertently introduce bloated code or overly permissive keep rules that bypassed optimization. By integrating the R8 Configuration Analyzer directly into the CI pipeline, the team created a feedback loop. Any new code that negatively impacts optimization scores is now flagged for review before it is ever merged into the main branch. This shift in culture—viewing optimization as a continuous process rather than a one-time event—is perhaps the most enduring result of the project.

Implications for the Superapp Ecosystem

The challenges faced by Grab are indicative of the broader "Superapp Dilemma": how to balance the need for rapid feature deployment with the physical constraints of mobile hardware. As mobile applications evolve to encompass more services, the traditional approach to development—where performance is an afterthought—is no longer sustainable.

Grab Reduces ANRs by 32% and improves startup time by 35% with R8 and Profile guided optimization | Android Developers' Blog

Industry analysts note that Grab’s methodology highlights the importance of "Compiler-Aware Development." By aligning the build system with the realities of the Android runtime, the team proved that performance is not merely a hardware or network issue, but a structural one. The ability to maintain a leaner binary while simultaneously increasing feature density provides a competitive advantage in emerging markets, where lower-end devices with limited storage and processing power remain the norm.

Future Outlook and Engineering Philosophy

Looking ahead, the Passenger App Core team intends to maintain this high standard of performance through constant monitoring. The use of R8, while transformative, is viewed by the team as the foundation for future work rather than the final destination. The integration of these automated checks has fundamentally changed how Grab’s engineers view their code; it is now assessed for its efficiency as much as for its functional correctness.

Nguyen Van Minh, Lead Software Engineer on the team, noted that the post-release spikes that once plagued the company have been effectively neutralized. By treating the compiler as an extension of the development team, Grab has successfully scaled its infrastructure to meet the demands of millions of users without sacrificing the quality of the user experience.

The success of this project serves as a template for other large-scale applications. It demonstrates that with the right combination of compiler tools, rigorous configuration management, and a commitment to continuous performance monitoring, it is possible to tame even the most sprawling, legacy-heavy codebases. As Grab continues to expand its footprint in Southeast Asia, this technical foundation will ensure that the superapp remains responsive and accessible to its massive, diverse user base.

Related Articles

Back to top button