<story><title>Faster TypedArrays: Vector Addition in WebAssembly</title><url>https://jott.live/markdown/wasm_vector_addition</url></story><parent_chain></parent_chain><comment><author>IvanK_net</author><text>BTW. you can unwrap loops in pure Javascript too, and it also makes the code several times faster.&lt;p&gt;4x unwrap: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;jsfiddle.net&amp;#x2F;49j7htdz&amp;#x2F;1&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;jsfiddle.net&amp;#x2F;49j7htdz&amp;#x2F;1&amp;#x2F;&lt;/a&gt;&lt;p&gt;8x unwrap: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;jsfiddle.net&amp;#x2F;49j7htdz&amp;#x2F;2&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;jsfiddle.net&amp;#x2F;49j7htdz&amp;#x2F;2&amp;#x2F;&lt;/a&gt;</text></comment>
<story><title>Faster TypedArrays: Vector Addition in WebAssembly</title><url>https://jott.live/markdown/wasm_vector_addition</url></story><parent_chain></parent_chain><comment><author>Matheus28</author><text>If we&amp;#x27;re not counting the time to zero out the array, it seems that typed arrays are slower than plain javascript because it&amp;#x27;s converting to &amp;amp; from floats&amp;#x2F;doubles back and forth. Try the same with Float64Array. My microbenchmark says f32 is 15% slower than f64 on chrome: &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;jsbench.me&amp;#x2F;gnkxxkjag8&amp;#x2F;1&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;jsbench.me&amp;#x2F;gnkxxkjag8&amp;#x2F;1&lt;/a&gt;</text></comment>