Discord Miguel Gaeta

How Discord Achieves Native iOS Performance with React Native

Article Summary

Discord runs millions of MAU on iOS with just 3 core engineers. Their secret? React Native—but only after a brutal performance overhaul.

When Discord's iOS app became nearly unusable on iPhone 6s despite once running smoothly on iPhone 5s, they formed a mobile performance squad. This deep-dive chronicles their systematic hunt through Flux stores, React components, main thread bottlenecks, gestures, and bundle loading.

Key Takeaways

Critical Insight

Through five optimization phases, Discord achieved consistent 60 FPS, slashed battery drain, and cut initial load time by over 2 seconds while maintaining their React Native foundation.

Continue reading

What This Article Covers

Problem

Discord's Flux store was eating up CPU cycles. User store updates took 30ms per emit, while message loading and caching actions hit 500ms on iPhone XS and 1000ms on iPhone 6s. The battery drain was real, even though frame rates stayed intact.

Solution

Miguel Gaeta's team moved user store listeners from top-level components down to the child components that actually needed them. They also swapped out the inline-compiled Unicode emoji regex for a pre-computed range regex that performed better on JSC.

Impact

Message parsing got 90% faster, dropping from 1000ms to 30ms on iPhone 6s. That cut nearly a second off time-to-interactive and reduced CPU and battery usage across all devices they supported.

The team almost went fully native for lists before discovering they'd already solved the problem once before on web.

This page summarizes “How Discord Achieves Native iOS Performance with React Native” by Discord, published Nov 7, 2019. All credit for the original work goes to the authors.

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

AI tools for React Native

Browse all AI tools →