Skip to content

Memory benchmark might be incorrect: Tauri might consume more RAM than Electron #5889

@jviotti

Description

@jviotti

Hey there! I'm researching the use of native web views in comparison Chromium (with Electron) and faced some unexpected results in terms of memory usage. The current memory benchmark (https://tauri.app/v1/references/benchmarks/) finds Electron to have a ~500 MB memory usage on Linux, being 2x from the one from Tauri.

The problem might be related to failing to account for shared memory, given that Chromium uses the same executable for multiple of its processes, with a significant part of them being read-only and thus actually shared. If we take these into account, the results are very different:

postman.com macOS 12.6.1 Ubuntu 22.04.1 Windows 10
Tauri 421 MB 581 MB 399 MB
Safari 471 MB
Electron 337 MB 240 MB 318 MB
Chrome 381 MB 370 MB
vscode.dev macOS 12.6.1 Ubuntu 22.04.1 Windows 10
Tauri 429 MB 572 MB 370 MB
Electron 332 MB 222 MB 312 MB

It appears the WebKit webview uses more memory for Web apps. The difference in memory usage was >90 MB and was present across multiple platforms, architectures, and multiple different uses of the webview (Tauri and Safari). These results are potentially surprising due to the popular notion that Electron is memory-hungry. Tauri using Edge WebView 2 had similar memory usage with Electron, which makes sense given both are based on Chromium.

While the base memory of i.e. Tauri and Sockets seem lower on macOS and Linux, they seem to increase very rapidly given actual real-world usage compared to i.e. Electron.

The tool that Tauri is using to do their memory benchmark, mprof, actually supports multiple backends for running. The default is just psutil, but they also have psutil_pss and psutil_uss.

We tested the default apps for Electron and Tauri, measuring USS and PSS, on Ubuntu and got these results

USS PSS
Electron 118 MB 207 MB
Tauri 125 MB 185 MB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions