Discord Rewrites Desktop and Mobile Clients in Rust Using Zed's GPU-Accelerated Rendering Framework
Discord’s CTO Stanislav Vishnevskiy recently announced rewriting its desktop and mobile clients in Rust, moving away from Electron and React Native. The project (codenamed Phoenix) eliminates layers of abstraction to directly leverage the device’s GPU, native mobile views, and a Rust core shared across platforms. Early results hint at a significant reduction in RAM usage and boot time for chat, voice, and streaming.
Vishnevskiy expanded on the rewrite on X:
We’ve been early adopters of Rust since 2018 and a lot of our infra, voice tech, and even some of the current client is already Rust, the holy grail was getting the whole client there. That means Electron goes away, and so does React Native, mobile keeps native UI but shares app code with desktop via Rust. We hope to get it into testing with users soon™. (And it’s not Tauri, it’s GPUI, so good guess everyone.)
The desktop app thus drops Chromium/Node.js for GPUI, the open-source, GPU-accelerated Rust UI framework built by the Zed team for the Zed editor. Zed is an open-source code editor written in Rust for macOS, Linux, and Windows by a team including the creators of GitHub’s Atom code editor, which was sunsetted in 2022, four years after Microsoft’s acquisition of GitHub. Zed touts a narrow focus on performance and user (i.e., developer) experience:
VS Code won by being good enough for everyone. Zed wins by being excellent for developers who refuse to compromise on speed.
Discord’s mobile app rewrite drops React Native, instead directly leveraging native iOS and Android views and reusing a common Rust core.
The browser client keeps rendering HTML with the application logic layer compiled to WebAssembly. Embedded web surfaces (e.g., YouTube videos and Activities), however, invoke an OS webview, with Electron’s built-in browser no longer available.
Vishnevskiy signals decreasing RAM usage, startup time, and latency as key motivations behind the rewrite:
The new Discord client using less RAM is just part of the story. Clicking around feels instant, I can’t go back. Check out the boot time.
Early internal builds for the desktop app reveal RAM usage at around 290 MB (measured with two accounts logged in simultaneously) and a near-instant cold start versus 5.5 s on Electron.
Vishnevskiy showcased similar improvements on mobile with a load time under 2 seconds for the rewrite versus approximately 5 seconds for the legacy app.
Elias Floreteng, in his master’s thesis at KTH this year (An Empirical Study of React Native’s New Architecture), reported performance gains across several metrics for native Swift and Kotlin over React Native, even with its new architecture. The controlled benchmark involves a 1,000-row scrollable image list using stock list and image components, with identical assets and row geometry across all binaries. Floreteng concludes that Swift beats React Native across every comparable runtime metric on iOS. On Android, the gap to native is small and runs in both directions, with native ahead on memory and CPU.
On desktop, Zed proved that leveraging GPUI could provide better performance over Electron and alternative frameworks reusing the device’s native webview (e.g., Tauri).
While Tauri also uses a Rust backend, it leverages the operating system’s native webview. This has the advantage of letting web developers reuse their knowledge of HTML, CSS, and JavaScript, while also avoiding the bundling of Chromium. Executable size is, as a result, generally smaller. Tauri apps’ RAM usage on Windows, however, tends to be similar to that of their Electron counterparts, as the same core, resource-hungry browser technology is used. Webview behavior may also be inconsistent across operating systems.
GPUI replaces the browser engine with a hybrid immediate and retained mode, GPU-accelerated UI framework that targets 120-frames-per-second rendering without garbage-collection pauses. In exchange for the reported performance gains, developers give up many rendering and accessibility features that come baked into the browser (e.g., text layout, input method integration, screen-reader accessibility hooks, right-to-left support). While miscellaneous Rust libraries exist to address some of these issues (e.g., Parley for text layout), developers still have to wire them into a consistent user experience.