element-desktop
element-desktop copied to clipboard
Consider switching from electron to tauri
Hi, This issue only applies to the desktop version, but the issue tracker is disabled on that repo so I asssume this tracker should be used.
I would suggest switching from electron to tauri once it is out of beta. Reasons for tauri:
- faster startup
- smaller bundle size
- less memory usage
- more focused on security
Here you can find a more detailed comparsion of both frameworks: https://github.com/microsoft/vscode/issues/118308#issuecomment-800078214
I don't think the core team will go ahead with a proposal like this, as electron has proven itself quite reliable, and tauri is something new.
If you can illustrate a working Element Desktop using tauri, without much maintainance overhead, with considerable performance improvements, only then I think will tauri be fully considered as an alternative.
I believe there are two main things to consider:
- Migrating all of the code would be a pain
- I am not very sure if Tauri supports things such as screen-sharing which are quite essential
Though I believe that if a community maintained version appeared and it supported all the features, some sort of migration wouldn't be impossible
I've built element-web using Tauri, looks like it works perfectly. Going to try to port element-desktop
Also; once possible, i'd like to see a feature-by-feature and benchmarking comparisons of the two, so that the element teams can see the tradeoffs themselves, this'd make the choice easier.
My results on testing element web on tauri vs element desktop on electron:
Bundle size:
- tauri: 21.4 MB deb package, 87.7 MB appimage
- electron: 82.4 MB deb package from official repository
Ram usage:
- tauri: 430 MB (I love to see that I done something wrong)
- electron: 227MB
And tauri is considerably slow and laggy (300 ms lag between mouse click and screen update). I believe the problem is that chrome is better than webkit-gtk, so on windows result should be more close (And I expect tauri outperforms electron on windows) because windows webview2 is based on chromium.
Does your bundle size comparison for tauri include the native bits of Element Desktop namely seshat & keytar?
No, I used element web for simplicity, as mentioned above. How much do you expect it would increase?
For the record, here is what I exactly done. You can replicate it in a little amount of time:
- Download element web tar from https://github.com/vector-im/element-web/releases/tag/v1.9.8
- Start a new tauri project via
npm x create-tauri-app
, select vanilla option - Unzip element into dist folder of the project
- Build the project using
npm run tauri build
- There will be an appimage and a deb package. I runned the appimage one, logged in to my account, and measured the ram usage and speed.
The extra element-desktop bits are 36MB when extracted from the deb
So... we should close this?
@HKalbasi
Bundle size:
* tauri: 21.4 MB deb package, 87.7 MB appimage * electron: 82.4 MB deb package from official repository
Ram usage:
* tauri: 430 MB (I love to see that I done something wrong) * electron: 227MB
And tauri is considerably slow and laggy (300 ms lag between mouse click and screen update).
Running this with your same instructions (no other config) and building on macos has given me slightly different results. I haven't experienced any lag with tauri so far in electron. And with Cinny its been awesome
Bundle Sizes:
- Tauri Bundle (Apple Silicon) 25.7mb
- Electron Bundle (Universal) 445mb RAM:
- Tauri Bundle ~250mb total (190mb for
tauri://localhost
and 41.5 mb forelement-tauri
) - Electron Bundle (Universal) ~500-600 total (I don't know if i measured it wrong see screenshot below)
@t3chguy
Does your bundle size comparison for tauri include the native bits of Element Desktop namely seshat & keytar?
I also used element web. Although on macos i get the following prompt when using Element-web built with tauri:
Does that mean that it actually does store the data in secure enclave as mentioned in vector-im/element-desktop#773
I've been looking for something better than an electron app for a while. I used to use the iPad catalyst app but tbh that really doesnt work well on a non-touchscreen device, and I dont think it makes sense spending time on porting a swift version solely for mac
Tauri Bundle (Apple Silicon) 25.7mb Electron Bundle (Universal) 445mb
Any chance to compare apples to apples (Universal v Universal)? Otherwise this is kind of misleading
I also used element web. Although on macos i get the following prompt when using Element-web built with tauri:
That'll be tauri using the keychain for its WebCrypto implementation, if you lack encrypted message searching then that's because you didn't bundle the native matrix-seshat
. Keytar will also access the keychain but won't say anything about WebCrypto.
Does that mean that it actually does store the https://github.com/vector-im/element-desktop/issues/773 as mentioned in https://github.com/vector-im/element-desktop/issues/773
You'd need to consult tauri docs for what it does with this WebCrypto Master Key, that isn't part of Element. It likely won't secure localStorage and IndexedDB though.
Any update about this?
Would love to see this happen!