element-desktop icon indicating copy to clipboard operation
element-desktop copied to clipboard

Consider switching from electron to tauri

Open niwla23 opened this issue 3 years ago • 14 comments

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

niwla23 avatar Jul 11 '21 20:07 niwla23

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.

ShadowJonathan avatar Jul 11 '21 23:07 ShadowJonathan

I believe there are two main things to consider:

  1. Migrating all of the code would be a pain
  2. 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

SimonBrandner avatar Jul 12 '21 05:07 SimonBrandner

I've built element-web using Tauri, looks like it works perfectly. Going to try to port element-desktop

mo-rijndael avatar Nov 25 '21 17:11 mo-rijndael

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.

ShadowJonathan avatar Nov 26 '21 00:11 ShadowJonathan

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.

HKalbasi avatar Jan 05 '22 17:01 HKalbasi

Does your bundle size comparison for tauri include the native bits of Element Desktop namely seshat & keytar?

t3chguy avatar Jan 05 '22 17:01 t3chguy

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:

  1. Download element web tar from https://github.com/vector-im/element-web/releases/tag/v1.9.8
  2. Start a new tauri project via npm x create-tauri-app, select vanilla option
  3. Unzip element into dist folder of the project
  4. Build the project using npm run tauri build
  5. 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.

HKalbasi avatar Jan 05 '22 17:01 HKalbasi

The extra element-desktop bits are 36MB when extracted from the deb image

t3chguy avatar Jan 06 '22 08:01 t3chguy

So... we should close this?

HKalbasi avatar Jan 06 '22 11:01 HKalbasi

@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 for element-tauri)
  • Electron Bundle (Universal) ~500-600 total (I don't know if i measured it wrong see screenshot below) Screen Shot 2022-09-17 at 6 51 28 pm

@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: Screen Shot 2022-09-17 at 6 25 59 pm

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

Roxiun avatar Sep 17 '22 10:09 Roxiun

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.

t3chguy avatar Sep 20 '22 08:09 t3chguy

Any update about this?

alfredonodo avatar Jul 14 '23 13:07 alfredonodo

Would love to see this happen!

Titaniumtown avatar Nov 14 '23 00:11 Titaniumtown