Discord is ditching Electron and its new app uses less RAM
496 points
• 7 days ago
• Article
Link
Discord 正在逐步告别 Electron,这是一款广泛使用的跨平台框架,允许开发者用 Web 技术构建桌面应用。尽管 Electron 曾是开发者的热门选择,但它经常因资源占用过高而遭到批评——在正常使用时也往往会消耗大量内存。 Discord 希望通过把桌面应用彻底迁移到 Rust 来缓解这些性能问题。 Rust 是一种现代编程语言,以高效和内存安全著称。
据 Discord 首席技术官 Stanislav Vishnevskiy 介绍,公司自 2018 年起就开始在基础设施和语音技术中引入 Rust 。让客户端完全基于 Rust 一直是开发团队的长期目标。此次迁移也意味着不再使用 React Native,不过 Discord 仍计划为移动端保留原生界面,并通过 Rust 与桌面端共享核心应用代码。
从内部测试结果来看,这一转变的优势已经开始显现。 Vishnevskiy 展示的预览表明,Discord 的 Windows 客户端运行时的内存占用约为 290MB 。考虑到目前基于 Electron 的 Windows 应用会根据用户同时参与的服务器数量轻松突破 1GB 内存,这无疑是显著的效率提升。
虽然尚未确认全面迁移到 Rust 的具体完成时间,但公司计划在不久的将来就启动与用户相关的测试。这样的战略调整体现了公司在优化平台性能、缩小系统占用方面的更大决心,最终将让依赖该应用进行日常沟通的用户获得更顺畅的体验。
Discord is moving away from Electron, the widely used cross-platform framework that allows developers to build desktop applications using web technologies. While Electron has been a popular choice for developers, it is frequently criticized for being resource-heavy, often consuming significant amounts of memory even during standard usage. Discord aims to address these performance concerns by transitioning its desktop application entirely to Rust, a modern programming language known for its speed and memory safety.
According to Discord chief technology officer Stanislav Vishnevskiy, the company has been integrating Rust into its infrastructure and voice technology since 2018. Achieving a fully Rust-based client represents a long-standing goal for the development team. This transition also involves moving away from React Native, though Discord intends to maintain native user interfaces for its mobile apps while sharing core application code with the desktop version via Rust.
The benefits of this shift are already apparent in internal testing. Vishnevskiy shared a preview showing the Discord Windows client operating on approximately 290MB of RAM. This represents a substantial efficiency gain, as the current Electron-based Windows app can easily exceed 1GB of memory usage depending on the number of servers a user is actively participating in.
While there is no confirmed timeline for when the full migration to Rust will be completed, the company plans to initiate testing with users in the near future. This strategic shift reflects a broader commitment to optimizing the platform's performance and reducing its system footprint, ultimately providing a smoother experience for users who rely on the application for daily communication.
439 comments • Comments Link
- Discord 已从 Electron 迁移到基于 Rust 、并使用 GPUI 框架构建的原生客户端,凸显行业更重视内存效率与性能,而不仅是为了获得基于 Web 的开发便利。
- 借助 LLMs 来完成"vibe-code"的原生移植,正在变得越来越常见,显著降低了把臃肿 Web 应用重写为高性能原生代码的门槛。
- 迁移到原生客户端可能会让对 Discord 的未经授权 modding 更难:由于基于 Rust 的应用程序可读性和混淆程度更高、二进制特性更强,相比对 Web 的 JavaScript 前端进行 modding,障碍更大。
- 尽管 Electron 常因臃肿而遭到批评,但一些开发者认为它仍提供了必需的"无聊"功能,例如可访问性、 IME/CJK 文本支持以及跨平台一致性;这些能力在自定义原生框架中往往缺位或实现不佳。
- Discord 对 GPUI 的依赖(该框架与 Zed 编辑器相关)表明,即便工具尚未完全成熟或标准化,企业也愿意采用专业的高性能方案。
- "一次编写、到处运行"的 Electron 承诺,正被越来越多的人视为一种过时的权衡:随着 AI 辅助编程的普及,把多个平台的原生实现维护起来,其成本变得更可控。
- 也存在对"去技能化"(deskilling)的担忧:如果过度依赖 AI 来移植大型代码库,可能导致机构知识流失,使团队在长期内难以理解和维护自身软件。
- 尽管原生重写带来性能优势,但失去浏览器级能力(如强大的开发者工具、以及更容易的修改与调试)仍然是高级用户面临的明显摩擦点。
- 在 Rust 中构建 UI 被认为在人体工程学方面更具挑战,因此出现了对相关技术的探索,例如在 Slint 中使用领域特定语言(DSLs),以简化对视觉布局的描述。
- 这场讨论也反映出对资源密集型应用的日益厌倦:用户更倾向于使用经过优化的原生软件,而不计其开发过程可能更复杂。
向原生、以性能为导向的架构转移,正在回应近几年桌面软件资源消耗不断攀升这一趋势。尽管"降低内存占用、缩短启动时间"的承诺备受欢迎,但这会在原生二进制的效率与 Web 技术栈所固有的可访问性、定制化与可维护性之间制造张力。在这一过程中,把 AI 代理作为力量倍增器既推动了快速创新,也引发了对长期技术债务累积以及人类主导的工程直觉被削弱的担忧。最终看来,整个行业正进入一个周期:钟摆正在从"全面押注 Web"转向一种更自律、更注重性能的桌面应用开发方式。 • Discord's transition from Electron to a native Rust-based client using the GPUI framework highlights a broader shift toward prioritizing memory efficiency and performance over the convenience of web-based development.
• Using LLMs to "vibe-code" native ports is becoming a common practice, significantly lowering the barrier to entry for rewriting bloated web applications into high-performance native code.
• The migration to a native client may complicate unauthorized modding of Discord, as the obfuscation and binary nature of Rust-based apps present a higher hurdle than modding a web-based JavaScript front-end.
• While Electron is often criticized for bloat, some developers argue it provides essential "boring" functionality—such as accessibility, IME/CJK text support, and cross-platform consistency—that custom native frameworks often lack or implement poorly.
• Discord's reliance on GPUI, a framework associated with the Zed editor, suggests that companies are willing to adopt specialized, high-performance tools even if they are not yet fully mature or standardized.
• The "write once, run anywhere" promise of Electron is increasingly viewed as an outdated trade-off, as AI-assisted coding makes the cost of maintaining native implementations for multiple platforms more manageable.
• Concerns exist regarding "deskilling," where the reliance on AI to port large codebases results in a loss of institutional knowledge, potentially leaving teams unable to understand or maintain their own software in the long term.
• Despite the performance benefits of native rewrites, the loss of browser-level features like robust developer tools and ease of modification remains a significant point of friction for power users.
• Building UIs in Rust is perceived as ergonomically challenging, leading to experimentation with Domain Specific Languages (DSLs) like those used in Slint to simplify the description of visual layouts.
• The discussion reflects a growing fatigue with resource-heavy applications, with users expressing a strong preference for optimized, native software regardless of the complexity of the development process.
The move toward native, performance-oriented architectures represents a reaction to years of ballooning resource consumption in desktop software. While the promise of reduced RAM usage and faster start times is universally welcomed, it creates a tension between the efficiency of native binaries and the accessibility, customization, and maintainability inherent in web-based stacks. The integration of AI agents as a force multiplier in this transition is both enabling rapid innovation and raising concerns about long-term technical debt and the erosion of human-led engineering intuition. Ultimately, the industry appears to be entering a cycle where the pendulum is swinging back from "all-in-on-web" toward a more disciplined, performance-focused approach to desktop application development.