The Truth about Rust/WebAssembly Performance

  Рет қаралды 165,815

Greg Johnston

Greg Johnston

Жыл бұрын

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-framewo...
Links:
- js-framework-benchmark: github.com/krausest/js-framew...
- Leptos: github.com/leptos-rs/leptos
- Dioxus: github.com/DioxusLabs/dioxus
- Sycamore: github.com/sycamore-rs/sycamore
- Yew: github.com/yewstack/yew

Пікірлер: 286
@gbjxc
@gbjxc Жыл бұрын
Sorry for the super small text! I forgot to bump it up in the terminal, but it's not a coding-focused video so hopefully it doesn't ruin it for you!
@gbjxc
@gbjxc Жыл бұрын
@@DavidChoiProgrammer Somebody buy me a time machine and I'll make as many videos as you want :-D
@sck3570
@sck3570 Жыл бұрын
@@gbjxc hopefully Elon will build one for us using Rust
@romanstingler435
@romanstingler435 Жыл бұрын
@@gbjxc on my way 😂🌌
@ted_marozzi
@ted_marozzi Жыл бұрын
Hey Greg, excellent video and awesome to see how good wasm already is. I would love a video on what would need to happen to make wasm faster than JS. Like go wild with what could happen, e.g wasm can manipulate dom, css, wasm spliting, ect. Intuitively, in my mind Rust should be able faster than JS as Rust is faster than JS, is there a flaw in this reasoning?
@user-zq8bt6hv9k
@user-zq8bt6hv9k Жыл бұрын
How fat a wasm library is? Last time I checked, a wasm hello world example was megabytes fat
@elina6969
@elina6969 Жыл бұрын
Maintainer of Yew here, this video was very helpful and informative. I want to clarify for any readers that the latest version had a performance regression which is fixed in git repo but it being a community maintained project, none of the maintainers have had the time to release it. I would like to have a chat about web assembly performance and improving Yew's performance, if you, Greg, or anyone else, is down for that
@gbjxc
@gbjxc Жыл бұрын
This is awesome to hear! I’ve done a couple small experiments with using wasm_bindgen string interning with Yew and found it dropped results in this benchmark down to the 1.48 range, which is great. I’ll open an issue to discuss when I have a little time.
@gbjxc
@gbjxc Жыл бұрын
(Just posted some stuff in the Yew discord assuming you're hamza1311 in there)
@fadichamieh
@fadichamieh Жыл бұрын
great to see this collaborative spirit guys...
@chrisbiscardi
@chrisbiscardi Жыл бұрын
I appreciated the way you talked about the entire ecosystem in a positive and uplifting or factual way here
@gbjxc
@gbjxc Жыл бұрын
Thanks! I think we’re all trying actively to avoid framework wars etc. For example, Dioxus team just made a couple PRs to Leptos to make server functions framework agnostic, etc. It’s all just Rust, in the end…
@__jan
@__jan Жыл бұрын
@@gbjxc Rust community is good at this kind of collaboration, because people have a strong desire to break out common components into their own crates that consolidate the ecosystem by allowing interoperation between different crates in the same category, examples include mint, winit, etc.
@maxmustermann-hx3fx
@maxmustermann-hx3fx 7 ай бұрын
@@gbjxc That is so wholesome convinced me to now learn Rust before my Systems Programming course starts next semester. Then I can use Rust instead of C or C++.
@forivall
@forivall Жыл бұрын
The creator of solidjs was a former co-worker of mine, and the framework we used at that company was god awfully slow, so it's pretty cool that he's created such a fast framework!
@oxey_
@oxey_ Жыл бұрын
in interviews and such he always seems like a cool guy, what's he like to work with?
@forivall
@forivall Жыл бұрын
@@oxey_ this was in 2014, so it was a while ago, but yeah, pretty cool; I can remember that he was passionate about solving problems. Although my experience with that job was overshadowed by our abusive boss, though I don't need to get into that.
@MadsterV
@MadsterV Жыл бұрын
working with awful code has been one of the main drivers for writing reusable solutions for me
@oxey_
@oxey_ Жыл бұрын
honestly besides the WASM vs vanillajs differences there's a LOT of information in this video, about how virtual DOM works, about various framework internals, there's the string encoding part and all your videos are like this, these really feel like a behind the scenes type video which is really cool
@ceriusgeek2749
@ceriusgeek2749 Жыл бұрын
Maybe it was unintentional but, I learned so much from this presentation that you earned yourself a subscriber.
@tommycard4569
@tommycard4569 Жыл бұрын
Continuing to enjoy the organization, clarity, and focus your videos. Keep up the great work!
@zahawolfe
@zahawolfe Жыл бұрын
This was incredibly helpful to understand the differences between these frameworks. Thank you
@ahmadaccino
@ahmadaccino Жыл бұрын
Really well formulated video. As a react dev interested in moving to wasm, this was a perfect intro into the space
@social.elenakrittik
@social.elenakrittik Ай бұрын
Thank you SO much man for how you've done the introduction! I wish more people did this "gist-of-the-video" type of intros, it saves so much time!
@andydataguy
@andydataguy Жыл бұрын
Great video! Just found your channel. Looks awesome 🙌🏾
@Munchopen
@Munchopen 7 ай бұрын
Man! You are cool bro! Take it to the benchmarks! Nailed the interpretation of the results. Showing immense knowledge of frontend frameworks! Wow! Keep it up!
@stephenbrown-bourne465
@stephenbrown-bourne465 Жыл бұрын
Really insightful video. Definitely going to consider wasm for my next project now
@Ma1ne2
@Ma1ne2 Жыл бұрын
Great video, very informative and you have a great character and spirit!
@ManuelTransfeld
@ManuelTransfeld 10 ай бұрын
Very informative. Thank you for your work on this video.
@aniketfuryrocks
@aniketfuryrocks 10 ай бұрын
As the creator of GxiRs-gxi, I am thrilled to witness developers carrying forward the idea that I had envisioned for wasm front-end frameworks. Due to time constraints, I haven't been able to devote much attention to the project myself. Nevertheless, I want to express my utmost support and enthusiasm for the ongoing progress. Kudos to all involved in the project!
@DMSBrian24
@DMSBrian24 Жыл бұрын
The "hope" of WASM replacing HTML+CSS+JS altogether isn't really from the performance standpoint, it's from development standpoint. Being able to develop everything in eg. Rust, skipping all the current kinks of JS, overall reducing the overhead as well as workload, the entry barrier, pretty much everything about it would be awesome and I'd pick this any day over a traditional front end stack even if it was a bit slower initially.
@DMSBrian24
@DMSBrian24 Жыл бұрын
And yeah, I know doing this is not the original/current "point" of WASM, but hey, one can only hope...
@d.sherman8563
@d.sherman8563 Жыл бұрын
Id say that’s the main reason people don’t use rust for fe actually. Far less mature and smaller ecosystem, high barrier to entry (new low level language to learn with a huge amount of things there aren’t libraries for and you’ll have to write yourself) all for a very marginal performance gain.
@lukaspotthast2142
@lukaspotthast2142 Жыл бұрын
@D. Sherman It is not about performance gains. It’s about leveraging the knowledge you gained by writing your backend in Rust. It’s about the language Rust being miles ahead of the clusterfuck that JavaScript actually is (and TypeScript, who’s type system has so many Problems of its own..). It’s about not needing the whole JS ecosystem and just using all the libraries you are already familiar with (serde, tracing, …). It’s about having the same „if it compiles, it works“ experience when developing your frontend.
@lukaspotthast2142
@lukaspotthast2142 Жыл бұрын
To the ecosystem. Rust was already mature enough 1 or 2 years ago. Libraries like Axum (backend) and Leptos (frontend) can be used in production without needing to write any additional libraries. To the learning curve: I would MUCH rather learn and master one single langue I love to use, instead of constantly dealing with different languages that all feel lacking in some aspects.
@DMSBrian24
@DMSBrian24 Жыл бұрын
@@d.sherman8563 That's always gonna be the case with new languages, especially complex ones like Rust. Still, enough people are clearly on board because of all the advantages it offers. A couple years back I hadn't even heard of the language, I got into it because of the FOSS community and nowadays I see local job postings from both startups as well as established companies looking for Rust devs - I'd say this rate of adoption is relatively fast, even if you compare it with early developments of eg. Python, which only really exploded in popularity in the last 10 years or so (it's easy to forget it's much older than javascript). I agree that Rust is complex and tough to learn (so is C, Cpp, Java and many others if you want to write good code in them), but I'd say it's already mature enough for production and rising adoption in the industry proves it. And since a lot of people already write desktop apps in it and it's actually quite amazing for creating GUI's (largely thanks to the macros), being able to essentially make webapps on the fly with WASM wouldn't just be convenient, it would be a game changer for the whole industry.
@ShallowClone
@ShallowClone Жыл бұрын
Awesome overview, thanks for the video😁
@romanstingler435
@romanstingler435 Жыл бұрын
Greg, I highly appreciate your content. I already compared the table back in the days but I love your thoughts and opinions.
@gbjxc
@gbjxc Жыл бұрын
Thanks, that's really kind!
@memespdf
@memespdf Жыл бұрын
Super interesting video, very informative. Thanks!
@marcopaolovaleriovezzoli5776
@marcopaolovaleriovezzoli5776 10 күн бұрын
Really interesting comparison. Thanks!
@RootsterAnon
@RootsterAnon Жыл бұрын
Such a great and informative video!
@dmitrygoyda
@dmitrygoyda Жыл бұрын
Wee need this. Keep up the good work 👍
@stuardcg
@stuardcg Жыл бұрын
Thanks for this type of content!
@everyhandletaken
@everyhandletaken Жыл бұрын
This is great content, learnt a lot from this!
@kobzkobzkobzkobz
@kobzkobzkobzkobz Жыл бұрын
great vid! loved the passionate narrating, half an hour worth spent :p
@seannewell397
@seannewell397 Жыл бұрын
Perf is one thing, the DX, the platform, and the options are another. Edge rendering, hybrid apps, RSC, sharing ts types... So much has gone into the JS ecosystem that my hesitation has been "what _else_ will I be giving up?" or "what does a full stack rust platform/stack look like?" FWIW i think lamba/edge starts for rust + using wasm in the browser could be spectacular. Like give 2-5x runway on free tiers perhaps if based on compute time! But dev productivity is an interesting angle, higher startup, lower maintenance?
@javiasilis
@javiasilis 10 ай бұрын
After messing with Yew for a while, I came to the conclusion that a Rust WASM project will make sense if: 1. You just love Rust. 2. You do need that faster startup times (especially on the free tier thing). 3. You need predictable performance in certain scenarios. 4. You have a much more defined code structure and will not be changing. It's as you've said. JS has had so much around its ecosystem that makes it easy to prototype and overcome some of its shortcomings.
@desuburinga
@desuburinga Жыл бұрын
Thanks for shedding light on some of the misconceptions about Rust and WASM! It is really cool to see there's actually not that much of a difference between vanillaJS and other Rust frameworks! What an exciting time we live in!
@combatLaCarie
@combatLaCarie Жыл бұрын
Love your presentation!
@nathanfranck5822
@nathanfranck5822 Жыл бұрын
The man! Glad to find you.
@Akshatgiri
@Akshatgiri Жыл бұрын
Dude! Great breakdown
@Roms8313
@Roms8313 Жыл бұрын
that was actually pretty interesting indeed ! thanks
@penguindrummaster
@penguindrummaster Жыл бұрын
Great overview, and I really like the deep dive into why the differences seen are there, as well as the context of what it all means. As a developer who primarily works in back-end or automation, I'm unfamiliar with the constraints of front-end work. Is it possible to get sub-second interactive page loads, or are we doomed to the 1.8s interactivity floor you showed in the chart? I know 1.8s is still "fast" by most standards, as the teams I help are often pushing 5-10 seconds before interactive, but the dream of a desktop-equivalent experience is that everything feels real-time without delay.
@RaflusEK
@RaflusEK Жыл бұрын
Great video, thanks!
@l3p3
@l3p3 Жыл бұрын
There should be a conference of all lead devs of the frameworks of this benchmark. I am in!
@stasgavrylov
@stasgavrylov Жыл бұрын
Thank you for a great overview, that was very informative and useful for us, "traditional" JS devs :D
@darklajid
@darklajid Жыл бұрын
Like the content, would appreciate if you could consider linking resources (in this case: I stopped the video and manually went to the js framework benchmark page) in the description?
@allesarfint
@allesarfint Жыл бұрын
The part that I'm interested the most about rust FE frameworks is the server-side speed, you can generate pages orders of magnitude faster with rust compared to nodejs, with the bonus of everything being written in the same language, so no dealing with js for client-side. But the amount of code to transfer and the memory usage is what turns me away from using a WASM framework the same way I don't want to touch React with a stick, and that's because of mobile. Most people daily drive slow devices with unreliable mobile internet connections, which is a problem when the page they try to use takes ages to load, doesn't download properly, or just straight up crashes the browser because of high memory usage, something more common than one would expect. I really hope WASM improves and resolves the issues holding it back, so we can finally get to use another real language in webdev, besides HTML.
@JuliaOrtiz-ti6ku
@JuliaOrtiz-ti6ku Жыл бұрын
If you’re facing those kind of issues with any JS library even in fairly complex applications it’s most likely an implementation problem. Most popular frameworks are heavily optimized for bundling and load speed. Besides, not using js to generate pages in the server is how the web has been from the beginning, using js for that is a fairly recent thing so I think you’re going in circles here.
@phoenix-tt
@phoenix-tt Жыл бұрын
@@JuliaOrtiz-ti6ku The idea is that now you can do JS for both client and server side code. And since JS is not at all ergonomic, Rust tries to replace it. It's very easy to do SSR, but for client-side code Rust Wasm is not mature enough to compete with JavaScript.
@AJ213Probably
@AJ213Probably 11 ай бұрын
so true on the wasm part for mobile. On facebook instant, the goal is to get very fast load times for games. Well, with wasm from Unity its not even possible to reach 2s load times even with an empty project (for low end mobile devices).
@steve-adams
@steve-adams Жыл бұрын
At 10:50 -ish you mention 20 characters of UTF-16 being 20kb. Would it not be 40-80 (2b to 4b encoding) bytes? Awesome video and explanation. This is the first video of yours that I've seen and I subscribed immediately.
@sid6576
@sid6576 Жыл бұрын
Great video!
@eboodnero
@eboodnero Жыл бұрын
this is great. at this point my priorities revolve around developer experience
@johndavid3114
@johndavid3114 9 ай бұрын
Great video thanks bro
@WoWbob396
@WoWbob396 6 ай бұрын
This channel is incredible! Really enjoy your delivery style, and love the content with nuanced perspectives that aren’t black and white.
@oefzdegoeggl
@oefzdegoeggl 6 ай бұрын
that looks like a good choice for something that has to do a lot of state changes purely on the client side without any server interaction. will be interesting to see what will happen once DOM modification directly from WASM is possible. i'm not too sure though how this would work out for low-frequency state updates with a roundtrip to the server ... might well be that minimal js and server-side rendering (e.g. actix-web + sailfish + htmx) would outperform here. for sure for the loading performance, but maybe also for rendering. browsers are extremely fast on html processing. obviously, your changed DOM causes html processing in the browser as well, but i talk about processing/diffing larger chunks as it would happen if the whole table got replaced by a server roundtrip.
@pastasawce
@pastasawce 11 ай бұрын
Very insightful, thanks for sharing. Now I wonder how I can apply this to webgl performance 🤔
@yukas1ngas
@yukas1ngas Жыл бұрын
It's very possible that WASM will be more popular in serverside than in browser. WASM-containers are really interesting
@fadichamieh
@fadichamieh Жыл бұрын
IMHO WebAssembly carries the potential to break all system / hardware specific limitations and should allow true reusable code for so many use cases!
@yukas1ngas
@yukas1ngas Жыл бұрын
@@fadichamieh The most important is absence of pointer arithmetic in principle. You don't need to check something that not exists. And there are a lot of task where security prevails over performance
@DooMWhite
@DooMWhite Жыл бұрын
Amazing content.
@verified_tinker1818
@verified_tinker1818 Жыл бұрын
This was illuminating. Thanks, Greg! I think the biggest drawback of WASM for front-end apps is iteration time. Changes you make in your code can take a bit to compile and show on the screen (and you’ll lose whatever state the app was in), whereas JS reflects them immediately. This is less important if most of your changes are to the logic and not the visuals, but otherwise, it can be a pain. Speaking of, would it be possible to somehow separate the logic from the visuals? To detect if the changes necessitate recompiling? Maybe the dev environment could have a watcher/build script that morphs the DOM instead, like Phoenix seems to?
@yuryzhuravlev2312
@yuryzhuravlev2312 Жыл бұрын
In JS the Vite do a fantastic job!
@SimonBuchanNz
@SimonBuchanNz Жыл бұрын
The js frameworks basically wrap each of your components in a hot reload component that stores the props and listens for hot reload signals from the bundler system, which is tracking what modules change on the dev server then sending what changed down a websocket. The way they currently do components Rust hot reload would need some deeper hooks into the build than I believe they currently have the ability to add, not just to detect what changed but probably also to split out the user code from the framework code (at the moment you can only really have one wasm file with one memory space) - but there's definitely ways to get around this, for example separate, non Rust, components that the dev server can treat differently but a "real" build can inline (and optimize) - it's just a lot of complex work that can't reuse much.
@ar4ys
@ar4ys Жыл бұрын
That's exactly what Dioxus does! If you make an update only to the "component template" (the code in the rsx macro) - then Dioxus will dynamically update the DOM tree, without recompiling the whole app. Albeit it's not ideal - if you change something on the rust side in macro (like code in event handler), it will still trigger the whole app rebuild, as you need to recompile rust.
@ZwartCode
@ZwartCode Жыл бұрын
Very Great content
@visionary_3_d
@visionary_3_d 11 ай бұрын
Great video
@tobias3581
@tobias3581 Жыл бұрын
Greg, thank you
@BosonCollider
@BosonCollider Жыл бұрын
Imho, the real tradeoff at this point is Rust vs Typescript frontend ecosystem. Overall I am really interested in Dioxus' rendering approach, since I also think it also works better for native backends where the cost of repainting rectangles isn't hidden away behind the DOM abstraction, and there is a lot of potential to optimize the rendering backends there. But of course at the same time the state management part of the react model is quite clunky, and signals or something similar is a great way to separate the rendering tree from the state tree. Imho, meshing Dioxus' approach with Vue's state management model is very promising. With that said, imho I would really have loved to see how logic programming languages would do for GUIs, and wasm is a promising platform to host other scripting languages than JS (speed is no longer the goal here). The main reason is that logic programming languages is probably the single best way to make two-way data binding work.
@T--T
@T--T 2 ай бұрын
you are a great teacher man
@brynyard
@brynyard Жыл бұрын
Web isn't used for it's performance. The reason web and performance is mentioned in the same sentence is because we need to find ways to mitigate all the performance challenges web has. Working on a large scale 3D multiplatform renderer the discussion about "fast" JS frameworks is quite silly. In our comparisons it's just a matter of "not that much slower" (ie: at least we're not counting orders of magnitude), "dead slow" (orders of magnitude) and "won't even run" (usually because of lack of/bad memory/resource management).
@frankszander2761
@frankszander2761 9 ай бұрын
Your writing makes no sense. Nobody argued: let's go web, because it's so fast. Point is, if you want to collaborate in real time (if it is work, or gaming, or whatever) over distance, you need something like the web. And than performance matters, even 10th of seconds. You don't think so? Try to enjoy a movie with delayed sound.
@brynyard
@brynyard 9 ай бұрын
@@frankszander2761 Uhm, you say that nobody says this, and then in the next sentence _you_ say it! Or what do you interpret as "The Web"?! I happen to write a collaborative app framework, and yes, over a distance, and NO, web is NOT something I need, because I don't need more problems. In the performance world I live in, fractions of milliseconds matter (that is fractions of 1/1000's of a second), and having to live in a VM with random stalls and no guarantees about timing is not ideal if you expect do do anything realtime.
@frankszander2761
@frankszander2761 9 ай бұрын
@@brynyard Well, the clip is about WebAssembly and FWs to build Webpages. And no. I said people use the web because that is the common (and for some the only) way to collaborate over a distance and not because of the performance.
@abdallahmeddah8461
@abdallahmeddah8461 Ай бұрын
I wouldn't pick rust over javascript for effeciency. I don't think we need better performance on the web today, but more statical typing and robustness, while keeping the access to web development pretty easy. The goal to me is to find a way so that with very little knowledge we can't mess up code and create invisible bugs, incoherent dependencies, while at the same time it shouldn't be very hard to develop a good web application. Rust looks a like a very good language for that, thank you guys for the frameworks you're developping!
@sck3570
@sck3570 Жыл бұрын
Hey Greg, Loved the video , Just one quick question, I am lactose intolerant can I use Leptos?
@gbjxc
@gbjxc Жыл бұрын
100% dairy-free baby
@31redorange08
@31redorange08 Жыл бұрын
I don't understand the question. Leptos isn't something you eat or drink. It's a web framework.
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 Жыл бұрын
@@31redorange08 oh dude
@danielnorred7458
@danielnorred7458 Жыл бұрын
That whole point about compile time verification of component diffing absolutely blew my mind. But it makes perfect sense. Holy heck that’s cool
@inconnn
@inconnn Жыл бұрын
off topic but something i've seen that's interesting is people actually using wasm outside the browser. which i should've expected considering javascript also got taken out of the browser but it's interesting to see. i've seen people considering using it as a scripting language for stuff like game engines which is an interesting application. i'm not very familiar with wasm so i'm not sure how bindings work, but the idea of being able to use any language that can compile into wasm for stuff like that is interesting.
@kevvvm9335
@kevvvm9335 Жыл бұрын
Glad to see SolidJS as representative of the JS frameworks.
@rahulshandilya304
@rahulshandilya304 Жыл бұрын
Thank you for creating wonderful library, now I can unlearn Javascript.
@_thehunter_
@_thehunter_ Жыл бұрын
can we have hybrid model like micro frontends.. so that on a large team some can focus on high performant wasm based framework on some critical viewsand other in react/vue..
@ssokolow
@ssokolow 5 ай бұрын
As someone happily running a 2011 CPU with the RAM maxed out to 32GiB for everything except web apps (I have a separate gaming rig I'm quite happy with... it's a hand-me-down of similar age with 8GiB of RAM and a Radeon HD 5870 from 2009), I'd say that WEB APPS IN GENERAL aren't ready for prime time, regardless of what they're written in. When normal "a few open tabs and a KZbin video at 480p" web browsing doesn't reliably maintain better P99 janklessness than games like Superliminal or A Hat In Time, something's wrong.
@citizenphnix
@citizenphnix Жыл бұрын
How did you set your text editor line numbering (in vim I assume)? That way of showing the line you are on and then the relative distance from that line is a brilliant move that I never thought of until this moment.
@gbjxc
@gbjxc Жыл бұрын
I’m a total nvim newb and copied my whole config from ThePrimeagen pretty much :-) the term here is “relative line numbers” I think. Super great for your j and k navigations
@DooMWhite
@DooMWhite Жыл бұрын
@@gbjxc Be careful with nvim, I just spent my entire day configuring it :P.
@charetjc
@charetjc Жыл бұрын
`:set rnu` to turn on, `:set nornu` to turn off relative line numbers
@platin2148
@platin2148 Жыл бұрын
How many more lines does it add compared to the equivalent javascript? Like how much tinier is the delivered website? And how much more convoluted will the implementation be?
@tomyamado
@tomyamado Жыл бұрын
I like the video, I might try some WASM on my portfolio. I agree that bigger applications might require a little more thought, the part that scares me the most is the size of the bundle, i hope WASM gets a code splitting feature, if they do, then its done. Greg I'd love to know why rust based frameworks were taking memory on startup even though they might not use it? Is it something rust related? I'm new to rust, I'm still reading the book and doing the rustlings course.
@mwcz5190
@mwcz5190 Жыл бұрын
One silver lining of wasm's generally-larger bundle size, is that wasm parsing can be streamed, so by the time the file is done downloading, it's pretty much already parsed and ready to execute. Contrariwise, JS files can't be parsed until they're fully downloaded (AIUI), and that parsing cost is larger for JS due to complex text syntax's disadvantages vs wasm's compact binary format. But still, I agree that code splitting should be made a lot easier. Right now, you have to create multiple wasm by hand and they can only communicate through JS. I don't know of any alternative to that at the moment.
@mwcz5190
@mwcz5190 Жыл бұрын
Whoops, I hadn't watched the whole video yet and Greg covered everything I just said. 😅
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 Жыл бұрын
@@mwcz5190 can WASM code run before everything is parsed?
@Andrew-jh2bn
@Andrew-jh2bn Жыл бұрын
​@@climatechangedoesntbargain9140 I believe the answer to that is no, everything has to be downloaded before it's ready to run. The browser can parse as the file is downloading, however, so it should be ready to go almost immediately after the last byte is received. I think JavaScript has to download the file completely before it can even begin parsing. The difference here comes from the fact that wasm is a binary format much closer to machine code, requiring the browser to do a lot less translating.
@climatechangedoesntbargain9140
@climatechangedoesntbargain9140 Жыл бұрын
@@Andrew-jh2bn yeah, but you can load JS incrementally, so it can run before everything is loaded, even though the inidivudal files have to be completely loaded before parsing.
@enclave2k1
@enclave2k1 Жыл бұрын
*Notice's Primeagen's harpoon vim plug* _"Ah, I see you're a man of culture as well"_
@winnie8614
@winnie8614 Жыл бұрын
I'm wondering, if browser can add support for UTF8 strings to JS? Or font rendering itself is tied to UTF16? Then perhaps Rust can make use of UTF16?
@PedroSanchez-od7cc
@PedroSanchez-od7cc Жыл бұрын
I'd like to see DX improvements for rust wasm ecosystem and rust in general.
@kylestubblefield3404
@kylestubblefield3404 Жыл бұрын
I saw nvim and harpoon!
@karixening
@karixening Жыл бұрын
That's really interesting about the cost of strings. Could you guys use utf-16 strings in the rust implementations?
@gbjxc
@gbjxc Жыл бұрын
It’s a good question - That may be a possible micro-optimization, but the issue is that the Rust String type is defined as UTF-8 so you either lose the *whole* ecosystem for working with strings in Rust, or pay the (relatively small?) performance cost. Certainly framework architecture ends up swamping the string cost, because Leptos/Dioxus are faster than Svelte/Vue/Preact etc simply because of our architectural choices.
@karixening
@karixening Жыл бұрын
@@gbjxc ​ Wow, I was not expecting a direct response from the creator a leptos-rs himself 😂. Primeagen is always hyping up what a cool tool this is. It probably would be more trouble than it was wroth, but I didn't know if you could use utf-16 strings for a subset of operations like accessing dom nodes as you mentioned earlier, and only perform the conversion when you needed the full power of the rust ecosystem.
@Cookiekeks
@Cookiekeks 11 ай бұрын
What a charismatic talker!
@florianbopp187
@florianbopp187 Жыл бұрын
Super interesting! As a frontend dev mostly working with vue, it’s so weird to me that it’s always dismissed so easily especially with it’s insane performance even though it is using v-Dom and it’s great community and easy to use api. Once vue 3 has vapor mode it should be on par with solid performance wise.
@CottidaeSEA
@CottidaeSEA Жыл бұрын
I think some people are simply jaded. It's like with Java, modern Java is amazing, but people remember the Java 1.5 days where doing just about anything sucked and younger developers haven't tried Java and just listen to the jaded seniors. Vue is probably in a similar situation.
@SentientNr6
@SentientNr6 Жыл бұрын
@toast Why is it a nightmare? You've got SFCs, typescript, ... What are the issues causing the nightmare?
@florianbopp187
@florianbopp187 Жыл бұрын
@toast I am working on a large project with vue and can’t complain. Vue 3 is awesome and has super easy to use APIs, the script setup syntax is basically identical to how svelte handles JS, vue 3 was completely written in typescript so that is also covered and the composition API and the ability to outsource logic into dedicated, statefull, TS modules is an amazing feature. I haven’t really worked with svelte a lot so I can’t compare the two fairly, but I can say that DX in vue 3 is first class!
@SimoneScanzoni
@SimoneScanzoni 11 ай бұрын
29:00 why wouldn't you use Leptos for an e-commerce? Stability? Or an e-commerce would need the best performance all-around, hence something like SolidJS would be better? Or for other reasons? BTW your content is great, thank you!
@kspatel2185
@kspatel2185 Жыл бұрын
Hello I'm actually new at web development. Is leptos good for seo if I dont use SSR? I actually want to make an lms marketplace for that I thought of using actix for the backend, so I thought, why not to go for front-end written in Rust. I dont want to learn two languages like JavaScript and then rust, just wanna stick with Rust so here I am. So is Leptos hood for SEO? Also does it support static site generation?
@JoaoFerreira-nr8cc
@JoaoFerreira-nr8cc 11 ай бұрын
I got confused about Yew vs wasm-bindgen, in these benchmarks are they "competing" or are they used together? I saw that Yew also uses wasm-bindgen, but wasm-bindgen scores better in the table, does that mean I can make a front-end using just wasm-bindgen without Yew and it will perform better?
@CuriousSpy
@CuriousSpy Жыл бұрын
The perfomance of wasm wasn't an issue for me as a frontend developer. It's the ecosystem behind framework. Frontend is not just interactivity (do smth on btn click). What about css support inside thoseframeworks? It's a big pain to even setup windi/tailwindcss properly. I have to use vite to bundle all my app (i know about rust alternatives they just very raw). What about animation capabilities? All those stuff matter and it's really sad to see that most of these frameworks are focused only on rendering perfomance. Yeah it's good. What's next?
@CuriousSpy
@CuriousSpy Жыл бұрын
Forgot to say thank you for video. Very helpful and interesting
@SilvestreVivo
@SilvestreVivo 9 ай бұрын
I think currently the dev experience of Rust in the frontend compared with frameworks like Svelte or Vue, is very bad. And that's pretty important too: Run time vs Code time. I think in the near future we'll see devs migrating to WASM but there is still a lot of work to do to compare JS experience with Rust in the frontend. Thanks for this helpful information!
@muska-ej7cv
@muska-ej7cv 8 ай бұрын
development experience is subjective. from a maturity standpoint it's not there. as far as writing code, i personally find it to have better dx. it's easier to start a project with js but gets harder as it grows. rust is the exact opposite where it's harder to start a project but gets easier as it grows. there are trade offs to both so it depends on the app you are intending to build.
@SilvestreVivo
@SilvestreVivo 8 ай бұрын
@@muska-ej7cvI think is not subjective when you can write less boilerplate and code in general so write a very simple component. Do you think a framework like Svelte or Vue scale worse than another Rust web framework? No way...
@muska-ej7cv
@muska-ej7cv 8 ай бұрын
@@SilvestreVivo there's less boilerplate/code in leptos than react or vue. svelte has the least but svelte is it's own language which makes that possible. leptos is just a clone of solid js/solidstart in rust. the leptos server api is also much simpler to implement than kit, nuxt, and next.
@SilvestreVivo
@SilvestreVivo 8 ай бұрын
@@muska-ej7cvThis confirms me that Svelte is sill easier that any web framework in Rust. That was my point. Maybe in the near feature will be different but not currently.
@muska-ej7cv
@muska-ej7cv 8 ай бұрын
@@SilvestreVivo yes but svelte is not javascript. it's a completely different language that has it's own compiler. it has such great dx because it's not javascript. solid has comparable dx to svelte and rust has better dx than js. even then svelte is not a completely sure thing for every project. the server api as i said is very confusing compared to the leptos server api. you don't get the type safety and other features that the rust language offers. on top of that leptos is faster on the client and server by a significant margin so you get performance advantages. there are trade offs to both so it comes down to the project and what you're intending to do.
@derschutz4737
@derschutz4737 Жыл бұрын
My thing is it felt like the memory part was just glossed over, thats a huuuge part of the performance I care about. You mentioned it could've been a leak, but this is supposed to be a basic benchmark so what are the chances all WASM frameworks are leaking in a basic program. If I am building a big app, I really do not want to be 3x the memory footprint of svelte/solid. Is there anyway WASM will be as memory efficient? I am not just talking about the startup metric, I mean overall. Are there scenarios where GC spikes will effect JS framworks but not WASM?
@gbjxc
@gbjxc Жыл бұрын
Yeah let me clarify: my point here is that the way memory is being measured in the benchmark doesn’t capture the actual memory usage. I’m not sure why it changed but if you look back at older benchmarks that were taken on OSX you see the memory usage is much more comparable krausest.github.io/js-framework-benchmark/2022/table_chrome_103.0.5060.53_osx.html I don’t know why the measurement is different on later Chrome versions and/or on Windows.
@thirdvect0r
@thirdvect0r Жыл бұрын
There' 2 different memory models being used -- with the rust/wasm examples, it's not that more memory is being used, just that more memory is being set aside to be used. Think of two different beach parties: one where the kids go wild, soda cups get left on the ground, and you send in the garbage person the next day to tidy up; and another where there's a defined area allocated for waste disposal. It might look like a lot of space is set aside for waste in the second case, but in reality it's a lot easier to manage such a party that way than just letting everyone throw their drinks cans on the floor.
@derschutz4737
@derschutz4737 Жыл бұрын
@@thirdvect0r My thing is, if my app is setting aside memory that isn't actually being used. That is still memory being taken up by my app, what I don't want is that the memory set aside is scaled alongside the actual memory being used, if its a fixed offset or just a buffer that eventually gets filled up when memory usage passes a certain point, then that's fine. So by memory usage all I am saying is that I don't want my rust app to have less memory available for other processes compared to a solid/svelte one. It doesn't really matter to me if technically speaking the rust one is actually a buffer and not the totality of actual used memory.
@derschutz4737
@derschutz4737 Жыл бұрын
@@gbjxc I'm just defining memory usage as, the delta between the total memory that are available for other processes to use before/after the app is loaded. Is it measuring that? And part of that includes some allocated memory not actually being used yet? For me, even if that 's not technically being used, if other processes can't use it then it counts as memory being used. Or is the memory usage just totally off and completely unrelated to real world memory metrics? I am curious why the windows results are so different than the OSX ones though.
@hilligans1
@hilligans1 Жыл бұрын
In my eyes memory usage is way more important of a factor than speed
@user-ht6tu6ks3u
@user-ht6tu6ks3u Жыл бұрын
Absence of separation info smaller bundles and lazy loading can be a problem for bigger rust front end apps.
@betterinbooks
@betterinbooks Жыл бұрын
is there a benchmark using a large, real life like project - say twitter like - that compares the load time and bundle sizes for leptos and javascript libraries? how does it "really" compare?
@andreialdea6072
@andreialdea6072 Жыл бұрын
Greg, the leptos man, you're doing good work here, full of coconut oil
@l3p3
@l3p3 Жыл бұрын
4:41 HA! There is my framework lui finally mentioned, at least in the form of text. xD
@Sancarn
@Sancarn Жыл бұрын
18:40 - Surely yew could do this too? Or is there a technical reason why these performance improvements couldn't be added to yew?
@technologyondemand4538
@technologyondemand4538 Жыл бұрын
I'm using Dioxus at the moment :p
@gbjxc
@gbjxc Жыл бұрын
We love Dioxus! (I mean, we love Leptos more but you know, we're all on the same team :-) )
@Jonas-Seiler
@Jonas-Seiler Жыл бұрын
I don’t why there is even this much of a discussion about performance, to me it was clear from the beginning, if react is fast enough, and its more than fast enough really, then pretty much everything else will also be fast enough. The speed of ui rendering is almost never a bottleneck on user experience anyways.
@c7rsed118
@c7rsed118 Жыл бұрын
probably the only thing is 3d engines, they don't access to DOM but use many cpu resources in calculations, but i don't think wasm can help with gpu calculations performance.
@whatwhat2573
@whatwhat2573 4 ай бұрын
if i write performance based code in c++ can i use wasm and see a significant performance improvement
@Zooiest
@Zooiest 10 ай бұрын
Is V8 able to auto-vectorize JavaScript code? If it isn't, applications could benefit from manual SIMD implementations in WASM
@ulicqueldromal
@ulicqueldromal 4 ай бұрын
Using the link in the description I cannot see Sledghammer in the benchmarks. I also can't find it in the git repository. Is there a fork that includes the rust frameworks?
@jandorniak6473
@jandorniak6473 Жыл бұрын
I think the thing about UTF-16 is about Asia - iirc CJK, and probably other Asian languages, fit most of their codepoints into a single UTF-16 symbol. UTF-8 is actually very West-centric.
@joachimfrank4134
@joachimfrank4134 Жыл бұрын
It's probably the only thing JavaScript and Java have in common. Java's default string representation is also UTF 16. So it could have been taken over from Java or have been some Java inter-operability thing.
@timseguine2
@timseguine2 Жыл бұрын
@@joachimfrank4134 Back when the decision was made the common wisdom was that "UTF-16 would be the future". That was back when "Unicode" was synonymous with the now defunct UCS-2. This turned out to be wrong. But hindsight is 20/20.
@brod515
@brod515 10 ай бұрын
this video made me realize how litte this all matters. all those meausrements are so close to each other percentage wise that there is really no difference between most of them.
@TheBestRTaken005
@TheBestRTaken005 Жыл бұрын
New to rust, but why not use UTF16 in WASM to match JS?
@user-dx7sb4hl2k
@user-dx7sb4hl2k 10 ай бұрын
I plan to learn Rust and use WebAssembly for the heavy rendering tasks, such as 3D rendering, in certain circumstances. However, I am not yet convinced of the developer productivity or ease of coding with JavaScript. I believe that Rust is a great language for making compilers or runtimes for JavaScript, but it is not a suitable replacement for JavaScript in all cases. Modern languages should also have modern syntax and code structures.
@richardgeddes630
@richardgeddes630 Жыл бұрын
What exactly is javascript string interop? My editor saves javascript files in utf-8. Does that mean that the js engine converts my js files, saved in utf-8, to utf-16 before executing?
@dynfoxx
@dynfoxx Жыл бұрын
He is referring to the Javascript runtime string representation. So not the type of your input file but the types used in the language itself. If you take a JS string in memory and look at it the representation it is not comparable with ascii or utf-8.
@richardgeddes630
@richardgeddes630 Жыл бұрын
@@dynfoxx Thanks for the clarification. Since it's an internal representation, it could be converted to utf-8 without breaking javascript programs? All internal handling of strings would also need re-tooling to deal with utf-8, I assume. Would there be a benefit and or downside to any other interested parties?
@dynfoxx
@dynfoxx Жыл бұрын
@@richardgeddes630 I'm not 100% sure what you are asking and I don't know the answer for sure. Basicly I belive the standard says all internal strings must be UTF-16 or there is a requirement that makes it inconvenient to use any other standard. It would be basically impossible to change at this point.
@PedroSanchez-od7cc
@PedroSanchez-od7cc Жыл бұрын
Could you share your neovim config files?
@V8Li
@V8Li 10 ай бұрын
I started coding in 2008 (IE6 as well), we coders did the work, followed standards, we now have good cross-browser compatibility and so on; and yet people don’t talk anymore about vanilla JavaScript performance. We are really going backwards, no wonder the economy is crap.
@talananiyiyaya8912
@talananiyiyaya8912 Жыл бұрын
In before Primeagen steals this content to fill time during his stream.
@lot.bajrami
@lot.bajrami Жыл бұрын
05:26 Angular 15 is at 1.5 for people who were wondering
@licriss
@licriss 9 ай бұрын
What I don't get is why all of the performance metrics seem to be around accessing the dom instead of just equivalent graphical effects entirely in wasm, have I just entirely misunderstood wasm itself?
@user-qr4jf4tv2x
@user-qr4jf4tv2x 7 ай бұрын
looks like running speed solidjs,leptos,yew,dioxus,sycamore Startup metrics solidjs, svelte,sledgehammer safety leptos,yew,dioxus,sycamore easy svelte,solidjs memory usage solidjs,svelte large community react,angular
@shitcoinsrus
@shitcoinsrus 9 ай бұрын
thanks for developing leptos! but if leptos is open source and free, how do you pay your bills?
An introduction to WebAssembly
25:23
Coding Tech
Рет қаралды 184 М.
Final muy inesperado 😨
01:00
Juan De Dios Pantoja
Рет қаралды 53 МЛН
New Wasm Platform And Standard WASIX??
10:27
ThePrimeTime
Рет қаралды 35 М.
Leptos Monthly Meetup: March 2024
1:25:56
Leptos
Рет қаралды 1 М.
All Rust features explained
21:30
Let's Get Rusty
Рет қаралды 269 М.
Jon Gjengset - Towards Impeccable Rust
55:59
Rust Nation UK
Рет қаралды 20 М.
Why WebAssembly is the future of Web development
7:33
ROULZ
Рет қаралды 179 М.
The Truth About HTMX | Prime Reacts
49:56
ThePrimeTime
Рет қаралды 327 М.
Why i think C++ is better than rust
32:48
ThePrimeTime
Рет қаралды 254 М.
Faster than Rust and C++: the PERFECT hash table
33:52
strager
Рет қаралды 491 М.