Tauri与Electron:性能、包大小及真实权衡
At Hopp, we're building a cross-platform remote control application designed for a low-latency remote pair programming experience. Providing the best possible user experience is our top priority.
在 Hopp,我们正在构建一个跨平台的远程控制应用程序,旨在提供低延迟的远程配对编程体验。提供最佳的用户体验是我们的首要任务。
Early in the development journey, the decision came to use either Tauri or Electron to build the app. Using one of these frameworks offered a promising way to avoid writing native code for each platform (Windows, macOS, Linux). This meant a crucial choice needed consideration.
在开发旅程的早期,决定使用 Tauri 或 Electron 来构建应用程序。使用这些框架之一提供了一种有前景的方法,可以避免为每个平台(Windows、macOS、Linux)编写原生代码。这意味着一个关键的选择需要考虑。
Both Tauri and Electron offer robust frameworks with fundamental differences. We needed to carefully consider these differences to decide which framework would best serve Hopp long-term.
Tauri 和 Electron 都提供了强大的框架,但存在根本性的差异。我们需要仔细考虑这些差异,以决定哪个框架能在长期内最好地服务于 Hopp。
If you currently weigh Tauri against Electron for your project, this post might help.
如果你正在为你的项目权衡 Tauri 和 Electron,这篇文章可能会有所帮助。
What this post covers:
本文涵盖的内容:
- The core differences between Tauri and Electron under the hood.
- Tauri 和 Electron 在底层的核心差异。
- The advantages and limitations associated with each framework.
- 与每个框架相关的优缺点。
- A benchmark comparing app size, startup time, and memory usage.
- 一个比较应用程序大小、启动时间和内存使用的基准测试。
- The reasoning behind choosing Tauri for Hopp.
- 选择 Tauri 作为 Hopp 的原因。
The main differences between Tauri and Electron#
Tauri 和 Electron 之间的主要区别#
When developers first research Tauri, they often encounter articles describing it as a "lighter Electron" or emphasizing the need to "learn Rust." While truth exists in these points, they don't capture the full picture. These two leading cross-platform frameworks have architectural differences that impact development and performance.
当开发者首次研究 Tauri 时,他们经常会遇到将其描述为 “更轻的 Electron” 或强调需要 “学习 Rust。” 虽然这些观点有其真实性,但并未捕捉到完整的图景。这两个领先的跨平台框架在架构上存在差异,影响开发和性能。
Let's dive into how Tauri and Electron operate behind the scenes.
让我们深入了解Tauri和Electron在后台的操作。
Electron's model
Electron 的模型
Tau...