DE — heise online
Rust across the board: Discord drops React and Electron
Software2 min read
Discord plans to drop Electron and React for its desktop app. It will build the core in Rust and share that core with its mobile apps.
What happened
Discord wants to stop using the Electron runtime and the React UI library for its clients. Discord's CTO, Stanislav Vishnevskiy, said this on X on Wednesday. Instead, the core of the app will be written in Rust, a fast and safe programming language. The desktop app will use the GPUI framework for its screens. The mobile apps will also use this shared Rust core. Android and iOS will keep their native screens, but React Native will be removed.
Why this change is not a surprise
Discord has been working with Rust since 2018. In 2020, it moved its message-reading service from Go to Rust. The company wanted to avoid sudden delays caused by the Garbage Collector, a tool that cleans up unused computer memory. Rust manages memory in a way that also worked well for real-time audio. Now Discord wants one shared codebase, which is the set of code files, for both desktop and mobile.
Key numbers and facts
- The new Rust base is expected to use less than 300 MB of memory (RAM). This number has not yet been tested by the public.
- Electron uses Chromium and Node.js, which can make the app use much more memory.
- Zed Industries released GPUI as open source for its code editor Zed. Zed reached version 1.0 in April.
- GPUI uses Metal on macOS, DirectX 11 on Windows, and wgpu on Linux to draw graphics.
Why it matters
This change could make Discord use less memory on computers. It could also make the desktop and mobile apps easier to keep in sync, because they share the same core code. GPUI is not yet at version 1.0, and changes between its versions can break code. So this move has some risk. Embedded content such as YouTube and Activities will still use the system's web views.
What to watch
- Whether the memory use of the new Rust app is really below 300 MB in public tests.
- How stable GPUI becomes as it moves toward version 1.0.
- How well the shared Rust core works on Android and iOS.
Glossary
- Electron
- A tool that lets developers build desktop apps using web technology. It uses Chromium and Node.js.
- React
- A library for building user interfaces on websites and apps.
- Rust
- A programming language known for speed and safe memory handling.
- GPUI
- An open-source UI framework from Zed Industries that draws screens using the computer's graphics chip.
- Garbage Collector
- A part of some programming languages that automatically frees up unused memory. It can cause short pauses.
- React Native
- A tool for building mobile apps with React. Discord will remove it.