<story><title>The Rusty Web: Targeting the Web with Rust</title><url>https://davidmcneil.github.io/the-rusty-web/</url></story><parent_chain></parent_chain><comment><author>sunfish</author><text>It looks like the slowdown on wasm is related to the powi call in the distance function (which the benchmark page mentions as a likely suspect). Emscripten currently compiles @llvm.powi into a JS Math.pow call, however this powi call is just being used to multiply a number by itself. I filed this issue:&lt;p&gt;&lt;pre&gt;&lt;code&gt;  https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;kripken&amp;#x2F;emscripten-fastcomp&amp;#x2F;issues&amp;#x2F;171
&lt;/code&gt;&lt;/pre&gt;
to track this issue in Emscripten.&lt;p&gt;In JS, the assumption is that code may be written by humans, so engines are expected to optimize things like Math.pow calls with small integer exponents implicitly, which is likely why this code is faster in JS. And in the asm.js case, the page mentions that it&amp;#x27;s using &amp;quot;almost asm&amp;quot;, which is not actually asm.js, so it&amp;#x27;s using the JS optimizations.&lt;p&gt;This is one of the characteristic differences between JS and WebAssembly: in WebAssembly, the compiler producing the code has a much bigger optimization role to play.</text></comment>
<story><title>The Rusty Web: Targeting the Web with Rust</title><url>https://davidmcneil.github.io/the-rusty-web/</url></story><parent_chain></parent_chain><comment><author>markdog12</author><text>Unreal Engine&amp;#x27;s Zen Garden using WebAssembly: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=13820633&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=13820633&lt;/a&gt;</text></comment>