<story><title>JavaScript to Rust and Back Again: A Wasm-Bindgen Tale</title><url>https://hacks.mozilla.org/2018/04/javascript-to-rust-and-back-again-a-wasm-bindgen-tale/</url></story><parent_chain><item><author>jerf</author><text>&amp;quot;Faster-than-JS DOM performance&amp;quot;&lt;p&gt;That will be when the clock starts ticking on Javascript.&lt;p&gt;Who&amp;#x27;da thunk one language might eventually eat both a significant chunk of C &lt;i&gt;and&lt;/i&gt; a significant chunk of Javascript someday?&lt;p&gt;I&amp;#x27;m &lt;i&gt;not&lt;/i&gt; saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily &lt;i&gt;could&lt;/i&gt; switch to Rust. But the framework war will take a &lt;i&gt;very&lt;/i&gt; interesting turn if Rust gets faster access to the DOM than JS can provide, and is &lt;i&gt;also&lt;/i&gt; a faster language than JS, and also tends to afford the use of more efficient constructs that Javascript can provide (i.e., can&amp;#x27;t do anything about cache coherency in JS, can&amp;#x27;t manage how much copying you do in JS directly, etc.). And if the ball starts rolling on this, the browsers will start doing things like allowing WASM to register correctly-typed events handlers that don&amp;#x27;t have to be marshaled into JS and back... it&amp;#x27;s been a long road and there&amp;#x27;s a long road ahead still but do I see the glimmer of a world in which browsers can actually perform within a factor of 2 of native UIs?</text></item><item><author>vvanders</author><text>&amp;gt; Faster-than-JS DOM performance&lt;p&gt;...&lt;p&gt;&amp;gt; The wasm-bindgen code generation has been designed with the future host bindings proposal in mind from day 1. As soon as that’s a feature available in WebAssembly, we’ll be able to directly invoke imported functions without any of wasm-bindgen‘s JS shims.&lt;p&gt;Sweet.&lt;p&gt;Once again, Rust team knocking it out of the park.</text></item></parent_chain><comment><author>flavio81</author><text>&amp;gt;Who&amp;#x27;da thunk one language might eventually eat both a significant chunk of C and a significant chunk of Javascript someday?&lt;p&gt;Erm... PSA: Rust isn&amp;#x27;t the &lt;i&gt;only&lt;/i&gt; language that is compiling to WASM.&lt;p&gt;I&amp;#x27;m glad for Rust developers (How exciting is for them to be able to target WASM), but what is really exciting is to have alternatives; even more exciting if they have nothing to do with javascript.</text></comment>
<story><title>JavaScript to Rust and Back Again: A Wasm-Bindgen Tale</title><url>https://hacks.mozilla.org/2018/04/javascript-to-rust-and-back-again-a-wasm-bindgen-tale/</url></story><parent_chain><item><author>jerf</author><text>&amp;quot;Faster-than-JS DOM performance&amp;quot;&lt;p&gt;That will be when the clock starts ticking on Javascript.&lt;p&gt;Who&amp;#x27;da thunk one language might eventually eat both a significant chunk of C &lt;i&gt;and&lt;/i&gt; a significant chunk of Javascript someday?&lt;p&gt;I&amp;#x27;m &lt;i&gt;not&lt;/i&gt; saying Rust will completely eat Javascript; there is no chance that all web developers would or even necessarily &lt;i&gt;could&lt;/i&gt; switch to Rust. But the framework war will take a &lt;i&gt;very&lt;/i&gt; interesting turn if Rust gets faster access to the DOM than JS can provide, and is &lt;i&gt;also&lt;/i&gt; a faster language than JS, and also tends to afford the use of more efficient constructs that Javascript can provide (i.e., can&amp;#x27;t do anything about cache coherency in JS, can&amp;#x27;t manage how much copying you do in JS directly, etc.). And if the ball starts rolling on this, the browsers will start doing things like allowing WASM to register correctly-typed events handlers that don&amp;#x27;t have to be marshaled into JS and back... it&amp;#x27;s been a long road and there&amp;#x27;s a long road ahead still but do I see the glimmer of a world in which browsers can actually perform within a factor of 2 of native UIs?</text></item><item><author>vvanders</author><text>&amp;gt; Faster-than-JS DOM performance&lt;p&gt;...&lt;p&gt;&amp;gt; The wasm-bindgen code generation has been designed with the future host bindings proposal in mind from day 1. As soon as that’s a feature available in WebAssembly, we’ll be able to directly invoke imported functions without any of wasm-bindgen‘s JS shims.&lt;p&gt;Sweet.&lt;p&gt;Once again, Rust team knocking it out of the park.</text></item></parent_chain><comment><author>jcoffland</author><text>Rust is also still very far from having eaten any significant chunk of C.</text></comment>