Skip to content
0:00 / 0:00

#leptos#wasm#rust

The Truth about Rust/WebAssembly Performance

Greg Johnston

9.2K subscribers • 1 video on Hallway

YouTube
  • Recommended by 3 people: 2 on Hacker News and 1 on Lobsters.
  • Presented by Greg Johnston, creator of Leptos
  • Linked in the descriptionkrausest/js-framework-benchmarkleptos-rs/leptosDioxusLabs/dioxus
  • May be out of date. The tools, versions or practices it shows have likely moved on.
  • An opinion. It argues one side of a question engineers disagree on.

Intermediate. Assumes working knowledge.

217K views3 years ago3 recommendations

Web developmentSystems programmingRustWebAssemblyWeb performance

Greg Johnston analyzes the performance of Rust and WebAssembly frontend frameworks, arguing that WASM is highly competitive for DOM rendering.

Over the last six months, frontend frameworks written in Rust and WebAssembly have begun overturning the old narrative that WASM is too slow for DOM rendering. In this video we'll take a look at several Rust/WASM frameworks to try to understand the truth about Rust/WASM performance. EDIT: To clarify about the memory usage: Something changed in the benchmark at some point in the way memory use is being reported, and I'm not sure why that is. If you go back to slightly earlier runs you can see better memory comparisons in which, for example, Sycamore is significantly more efficient than Solid, Yew much more memory efficient than React, etc. I'm pretty sure it was the benchmarking that changed, not the frameworks. Check results here, for example: krausest.github.io/js-framework-benchmark/2022/table_chrome_… Links: - js-framework-benchmark: github.com/krausest/js-framework-benchmark - Leptos: github.com/leptos-rs/leptos - Dioxus: github.com/DioxusLabs/dioxus - Sycamore: github.com/sycamore-rs/sycamore - Yew: github.com/yewstack/yew

Why it's here

3 people recommend this

What people say. Recommended as a great analysis showing that WebAssembly frontend frameworks can compete with fast JavaScript frameworks in DOM performance.

pdpion Hacker News • Recommends

On “Can Rust Beat JavaScript in 2023?”

Greg Johnston, author of the Leptos framework, did a pretty good video about this a few weeks ago0. The TLDR is (of course): it depends. WASM has no native access to the DOM, so all DOM manipulations from wasm-land have to go through JS bindings with all the (de)serialisation costs that go with crossing the language boundary. That eats up a lot of whatever performance gains you'd see from rust-on-wasm for pure compute. 0. link to this video

theironhammeron Hacker News • Recommends

On “Ask HN: Real world Svelte speed difference compared to virtual DOM frameworks?”

link to this video This video might be helpful. Leptos uses Signals, borrowing ideas from SolidJS to update the DOM. There's no VirtualDOM like React. Svelte also doesn't use a VDOM. When there's a state change React has to rerender the entire VDOM tree and the diff it with the real DOM, whereas using the Signals model those frameworks make the change directly in the real DOM. I'm not sure how Svelte manipulates the DOM exactly but I it's similar to how it's done with Frameworks that use Signals such as Leptos and SolidJS. I would say Developer velocity is key if you're a developer. Svelte is a big winner here as it's mental model is easier to understand than React's.

bwron Lobsters • Recommends

The Truth about Rust/WebAssembly Performance

u/rudedoggin r/Zig • Mentions

On “does zig have a front end framework?”

Check out this video about Rust frontends: link to this video You could do the same thing with Zig AFAIK.

rapnieon Hacker News • Mentions

On “Snappy UIs with WebAssembly and Web Workers”

…WebAssembly/WebGL isn't the only way in which Makepad is available. And while running well in the browser for a time, there were issues to be solved here (addressed in the presentation). And tbh this isn't a real answer to your assertion. Greg Johnston, creator of Leptos, has made a video with performance comparisons 2. 0 link 1 link 2 link to this video…

azemetreon Hacker News • Mentions

On “Snappy UIs with WebAssembly and Web Workers”

Have you seen the video posted in the parent, by the creator of leptos (a rust webassembly framework)? link to this video The benchmarks being displayed have leptos beating react in nearly every category.

nanaianon Hacker News • Mentions

On “Web browser as GUI, with your preferred language in the backend”

Wasm threads via SharedArrayBuffer have been a thing for like 5 years. In Rust you can use wasm-bindgen-rayon, for instance. DOM access is and has always been easily achieved through imports. It's performant, too: link to this video

jbjohnson Hacker News • Mentions

On “Platform Strategy and Its Discontents”

The founder of Leptos makes a pretty good argument 1 that the bottleneck for WASM isn't really the DOM and that they are already faster than some popular JS frameworks even with the current constraints. 1 link to this video

tcfhgjon Hacker News • Mentions

On “Farewell Rust”

the JS layer is slow, indeed, but it shouldn't be that much slower that it meaningfully impacts frontend apps A demonstration of that by the creator of Leptos: link to this video

tcfhgjon Hacker News • Mentions

On “Making WebAssembly a first-class language on the Web”

> no DOM access meant the only viable use cases were compute-heavy workloads like codecs and crypto, no, it didn't mean that, because the overhead is not a deal breaker: 1) you don't have to do the glue code (libs can do it for you) 2) there's overhead due to glue, but the overhead is so small that WASM web frameworks easily can compete with fast JS frameworks in DOM heavy scenarios. Source: Analysis of the creator of Leptos (a web framework based on WASM): link to this video

u/slightly_saltyin r/Kotlin • Mentions

On “Kotlin JS/ Kotlin react feels kind of dead atm...”

A good watch [video