<story><title>Single Page Applications using Rust</title><url>http://www.sheshbabu.com/posts/rust-wasm-yew-single-page-application/</url></story><parent_chain><item><author>muglug</author><text>&amp;gt; you can actually take advantage of its low-level nature in the browser for performance critical tasks within your app.&lt;p&gt;Yeah, but the problem is that 99.9% of front-end work is only performance-critical for DOM rendering (the 0.1% is stuff like video encoding &amp;amp; decoding) and WASM can&amp;#x27;t help with that.</text></item><item><author>danShumway</author><text>A few advantages:&lt;p&gt;- Rust compiles to WASM, not JS, so you can actually take advantage of its low-level nature in the browser for performance critical tasks within your app.&lt;p&gt;- The Rust code you&amp;#x27;re writing is still statically compiled, so you still get to take advantage of Rust&amp;#x27;s typechecking and IDE features.&lt;p&gt;- Some people just like writing Rust code more than Javascript. Part of the reason Javascript took off so quickly on the server was because there&amp;#x27;s a huge productivity boost from using one language everywhere. Similarly, if you love Rust but think that Javascript paradigms around prototypes, closures, or `this` are weird, you get to ignore that and take advantage of one of the best app distribution platforms in the world without learning a new language.&lt;p&gt;I pretty solidly hold to the position that increasing language diversity on the web is a good thing. Particularly with Rust, since they&amp;#x27;ve put in the work to have proper, accessible support that&amp;#x27;s still separating app logic from DOM layout and CSS styling. I&amp;#x27;m really happy with how their community has approached building out Rust as a first-class language on the web rather than just as native language that happens to have a web compile target.</text></item><item><author>sharpercoder</author><text>The promise of Rust is safe and fast low-level development. What is the primary selling point of using rust for webdev? Speed? I can mainly see disadvantages when using rust for this scenario.</text></item></parent_chain><comment><author>brundolf</author><text>&amp;gt; 99.9% of front-end work is only performance-critical for DOM rendering&lt;p&gt;There are two meanings of &amp;quot;DOM rendering&amp;quot; in the context of UI-as-a-function-of-state libraries: 1) generating the virtual DOM from data, and 2) modifying the real DOM to match it. Arguably there&amp;#x27;s even a 3) browser reflow as a result of those DOM changes.&lt;p&gt;You&amp;#x27;re right that 2 and 3 can&amp;#x27;t really be helped by WASM. But 1 can, and while it&amp;#x27;s not &lt;i&gt;usually&lt;/i&gt; the bottleneck, it certainly can be. At my last company it was not terribly uncommon that fixing UI jank came down to eliminating unnecessary React render function calls because the sum total of them all - running the actual JavaScript logic - was taking too long. Assuming yew computes the virtual DOM in WASM (I don&amp;#x27;t see how it could be otherwise), the performance increase could definitely be beneficial for certain highly-complex apps.</text></comment>
<story><title>Single Page Applications using Rust</title><url>http://www.sheshbabu.com/posts/rust-wasm-yew-single-page-application/</url></story><parent_chain><item><author>muglug</author><text>&amp;gt; you can actually take advantage of its low-level nature in the browser for performance critical tasks within your app.&lt;p&gt;Yeah, but the problem is that 99.9% of front-end work is only performance-critical for DOM rendering (the 0.1% is stuff like video encoding &amp;amp; decoding) and WASM can&amp;#x27;t help with that.</text></item><item><author>danShumway</author><text>A few advantages:&lt;p&gt;- Rust compiles to WASM, not JS, so you can actually take advantage of its low-level nature in the browser for performance critical tasks within your app.&lt;p&gt;- The Rust code you&amp;#x27;re writing is still statically compiled, so you still get to take advantage of Rust&amp;#x27;s typechecking and IDE features.&lt;p&gt;- Some people just like writing Rust code more than Javascript. Part of the reason Javascript took off so quickly on the server was because there&amp;#x27;s a huge productivity boost from using one language everywhere. Similarly, if you love Rust but think that Javascript paradigms around prototypes, closures, or `this` are weird, you get to ignore that and take advantage of one of the best app distribution platforms in the world without learning a new language.&lt;p&gt;I pretty solidly hold to the position that increasing language diversity on the web is a good thing. Particularly with Rust, since they&amp;#x27;ve put in the work to have proper, accessible support that&amp;#x27;s still separating app logic from DOM layout and CSS styling. I&amp;#x27;m really happy with how their community has approached building out Rust as a first-class language on the web rather than just as native language that happens to have a web compile target.</text></item><item><author>sharpercoder</author><text>The promise of Rust is safe and fast low-level development. What is the primary selling point of using rust for webdev? Speed? I can mainly see disadvantages when using rust for this scenario.</text></item></parent_chain><comment><author>cogman10</author><text>&amp;gt; the 0.1% is stuff like video encoding &amp;amp; decoding&lt;p&gt;In which case, rust still isn&amp;#x27;t a good fit for a front end library (Unless you are patching in support for a new codec into old browser).&lt;p&gt;Frankly, the browser will have a faster version of the codec that can also take advantage of other hardware that you wouldn&amp;#x27;t want to expose to WASM.</text></comment>