Live data from Hacker News

Tauri: An Electron alternative written in Rust

tauri.studio

121–130 of 438 posts

Re: Tauri: An Electron alternative written in Rust

#121

Looks like it uses system webviews instead of bundling a copy of Chromium? This to me seems like the real headlining feature, but strangely I had to dig pretty deep to find it: https://tauri.studio/en/docs/getting-started/technical-detai... I kind of wonder why it took this long for someone to try this approach. It just makes a whole lot more sense on the surface. Interesting thing I just thought about: since users d…

People have been trying the WebView approach for years. (Projects include: Quark, Electrino, DeskGap, Revery, and Neutralino.)

Historically, it worked terribly on Windows.

On Windows, if you used the OS WebView, your Windows 7 users would be forced to use IE11 to run your app, even if they had a newer/better browser installed locally. On Windows 10, you'd get whatever random version of Edge was installed, or the new Chromium-based Edge.

In 2021, we're in a new era for Windows WebViews, thanks to Microsoft shipping WebView2 at the end of 2020, which ensures that the OS-provided WebView will be a modern version of Chromium. https://docs.microsoft.com/en-us/microsoft-edge/webview2/ Tauri supports WebView2 and I bet it will work a lot better than historical approaches.

Support is still pretty dicey on other platforms, though. macOS doesn't have anything like WebView2, so if you want to support a five-year-old version of macOS (which isn't that old in desktop terms), you'll be forced to support and test your app on a five-year-old version of Safari. (The user might have upgraded to a two-year-old version of Safari, but they might not, if they prefer Firefox or Chrome, and that's now your problem.)

The easiest and best way to improve the user's experience on old OS versions is to provide your own copy of Chromium, like Electron does.

At that point, if you've shipped an Electron app for macOS and Linux, maybe you just wanna ship an Electron app for Windows and call it a day?

Having said that, if you can keep your OS-version support matrix tight, Tauri might work OK for you.

Re: Tauri: An Electron alternative written in Rust

#122

Earlier quoted context omitted.

Unlikely, because Electron is very useful in exposing system and hardware APIs.

For most apps - wouldn't PWA's be sufficient as implemented today. Presumably, they'll expose more and more hardware APIs over time?

Even basic things like reading and writing files from the filesystem are obnoxiously difficult in a pure browser or PWA environment. Storing state in general is full of enormous pitfalls and eccentricities, like 50mb limits for some browsers or just completely random total deletion of all app state at the browser's whim.

Re: Tauri: An Electron alternative written in Rust

#123
post #99

Earlier quoted context omitted.

That's not the baseline though, the baseline RAM consumption for an Electron app is about 100MB. If you have garbage code as input it doesn't matter which stack executes it, you'll have garbage performance output.

Even 100MB is crazy. I know RAM is cheap but the absurdity of that amount is beyond me.

It's a lot for sure, but it's not quite that simple:

- First of all the amount of RAM consumed actually depends on how much free RAM you have, Electron thinking it's a browser boggles up some extra RAM "just in case", which is a tread-off that probably works better for actual browsers than the average Electron app.

- Secondly while displaying "hello world" costs you ~100MB of RAM the RAM required as the app scales in complexity doesn't scale quite that fast, you may very well work on your app for a year and still need about ~100MB or RAM for it, you'll have to write very inefficient code (or keep a lot of data in memory) for it to require 1GB for JS' heap or something crazy like that.

Still ~100MB is a lot for sure, I think a lot of it could be trimmed away if the developers really tried to lower memory usage significantly, like maybe a much more efficient "Electron Mini" could be made with some effort.

Re: Tauri: An Electron alternative written in Rust

#124
post #16
post #6

Each Electron application seems to think it's the only one running in a computer. It's the only way, I imagine, they think it's acceptable the amount of resources they need to run.

As a developer shipping executables to MacOS, Windows, and Linux today this is the only assumption I can make. I cannot assume that dependencies exist or are the correct version, I can't assume the user knows that package managers exist or that the dependencies shipped by the package managers are correct, I can't assume anything exists on PATH or LD_LIBRARY_PATH, and I can't even assume that libc or libc++ on a syste…

16GBs of memory isn’t enough for me anymore.[1] Although that is mostly due to Intellij and the Web at large (my browser).

[1]https://news.ycombinator.com/item?id=26120743

Re: Tauri: An Electron alternative written in Rust

#126

Earlier quoted context omitted.

Pity they can’t use Servo as the rendering engine, even if it only deals with a small subset of style/layout properties. That kind of parallel layout engine should make building fluid 60fps interfaces a lot easier.

Why can't they?

Servo is quite large and extremely difficult to build from source. We've tried to make it work with Tauri but decided it's not worth it, at least for now.

Re: Tauri: An Electron alternative written in Rust

#127
post #97

Earlier quoted context omitted.

Not much different but enough to be dangerous. Older Windows use Trident, 10 still uses EdgeHTML, many people are stuck with old Androids that don't have up to date engines (not sure if Android is a target, wasn't easy to find in their website), and webviews have access to the system in ways a website doesn't (like reading files or using the camera without having to ask for permission or being allowed to issue reques…

But we know from web statistics that these are very few people and shrinking every year.

That is not how it works on Windows, as you have to ship either the Webview2 runtime or installer with your app - otherwise you’re stuck with the old rendering engines.

At which point, it’s just easier to ship Electron.

Re: Tauri: An Electron alternative written in Rust

#128
post #89

Earlier quoted context omitted.

Why can't they?

AFAIK there are no V8 Servo bindings. So in theory (I don’t know Servo well at all) you could render a static HTML document but you’d have no DOM JS APIs to work with.

Servo uses SpiderMonkey as its JS engine, and supports some DOM apis.

Re: Tauri: An Electron alternative written in Rust

#129

Earlier quoted context omitted.

> A major benefit of Electron is that you can develop against a single browser version and don't have to deal with all the small but time consuming compatibility quirks. Somehow I doubt the ideal solution is to bundle a web browser with every app. Electron feels like a prototype that went out of control.

I think they're overstating the browser compatibility problem too. It was really bad 15 years ago, but today it is almost a non-issue. Between significantly improved standardization of web technologies, and new tricks like polyfills, I think it has become pretty uncommon for apps to not just work on multiple browsers without any tinkering.

I use Chrome, Safari and Firefox on a Mac.

In my experience, unfortunately it isn't true that apps work with very high reliability. This is why I use multiple browsers. I don't want to use Chrome, and I encounter new websites with functionality that don't work properly in Safari or Firefox quite regularly. Some of this is even quite basic functionality.

From things like shopping carts where the final payment button doesn't work in Firefox (nothing happens), to video conferencing that sort-of works in Safari but then the audio breaks while it is reliable in Chrome.

Even GitHub doesn't render properly in Safari occasionally (the page is full of weird size text and giant rectangles). But that's almost certainly a Safari bug.

Re: Tauri: An Electron alternative written in Rust

#130
post #14

The Electron alternative that possibly isn't one. Electron apps are usually quite heavy because they bundle Chrome. Tauri doesn't and instead relies on webview, which uses a different browser engine dependent on your platform, with all the incompatibilities that come with it.

> Tauri doesn't and instead relies on webview, which uses a different browser engine dependent on your platform, with all the incompatibilities that come with it. Isn't windows system webview now a chromium fork? This should make incompatibility on the major platforms now much less of an issue.

That updated Webview is, still, not the default on Windows. You have to ship it yourself.
Post reply on HN