PhonePe Ayush Bagaria

How PhonePe Enhances Chat Performance on PhonePe Android - Part 2

Original post Enhancing Chat Performance on PhonePe Android - Part 2

Article Summary

Ayush Bagaria from PhonePe reveals how CPU profiling and thread optimization slashed chat load times by 30%. Most Android apps are sitting on similar performance gains.

This is Part 2 of PhonePe's deep dive into optimizing their Android chat experience. After achieving 20% improvement through database and pagination fixes (Part 1), the team turned to CPU profiling and thread management to squeeze out even more performance.

Key Takeaways

Critical Insight

Combined with Part 1 optimizations, PhonePe reduced chat page load time (P90) from 1.5s to 750ms, a 50% improvement over 9 months.

Continue reading

What This Article Covers

Problem

PhonePe's chat feature was slow because the ViewModel kept switching threads to fetch configuration variables one at a time from SharedPreferences during startup.

Solution

The team built a custom configuration class that holds all the variables as members. This let them fetch everything from SharedPreferences in a single operation, cutting out the extra thread switches.

Impact

This configuration change, along with other improvements like removing unnecessary coroutine launches and using ViewStubs for complex layouts, helped the chat load 30% faster.

The team hints at AsyncLayoutInflater and database redesign experiments that could push performance even further in a potential Part 3.

This page summarizes “Enhancing Chat Performance on PhonePe Android - Part 2” by PhonePe, published May 13, 2024. All credit for the original work goes to the authors.

Read the original on tech.phonepe.com (opens in new tab)

AI tools for Android

Browse all AI tools →