<story><title>WebAssembly techniques to speed up matrix multiplication</title><url>https://jott.live/markdown/mm_wasm</url></story><parent_chain></parent_chain><comment><author>phkahler</author><text>Another technique is to transpose the left matrix so each dot product is scanned in row-order and hence more cache friendly.&lt;p&gt;Another one I tried ages ago is to use a single loop counter and &amp;quot;de-interleave&amp;quot; the bits to get what would normally be 3 distinct loop variables. For this you need to modify the entry in the result matrix rather than having it write-only. It has the effect of accessing like a z-order curve but in 3 dimensions. It&amp;#x27;s a bit of overhead, but you can also unroll say 8 iterations (2x2x2) which helps make up for it. This ends up making good use of both caches and even virtual memory if things don&amp;#x27;t fit in RAM. OTOH it tends to prefer sizes that are a power of 2.</text></comment>
<story><title>WebAssembly techniques to speed up matrix multiplication</title><url>https://jott.live/markdown/mm_wasm</url></story><parent_chain></parent_chain><comment><author>zwieback</author><text>Very cool!&lt;p&gt;My question: will this kind of thing become more mainstream? I&amp;#x27;ve seen the web emerge, go from static pages to entire apps being delivered and executed in the browser. The last bastion of native apps and libraries seems to be highly optimized algorithms but maybe those will also migrate to a deliver-from-the-web and execute in some kind of browser sandbox.&lt;p&gt;Java promised to deliver some version of native code execution but the Java app&amp;#x2F;applet idea never seemed to take off. In some ways it seems superior to what we have now but maybe the security concerns we had during that era held Java back too much. Or am I misunderstanding what WebAssembly can bring to the game?</text></comment>