metafizzy / zdog

Flat, round, designer-friendly pseudo-3D engine for canvas & SVG

Home Page:https://zzz.dog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Would wasm make it any faster?

ryansupak2 opened this issue · comments

Sorry if this is a dumb question, and I browsed the source code and it looks pretty small and tight already. But would a WASM build of zdog make it faster or more performant?

Zdog source code is built to be run in the browser without compilation. It's designed to be a browser plugin — although in theory, it could be ported to other rendering engines.

As for WASM WebAssembly — I don't have any expertise here. Zdog is based on <canvas> which has a JS API. I'm not familiar with low-level shape rendering API that browsers use. I'm curious to here where any benefit could be.

Hi! I'm by no means an expert on this but I think the key advantage of WASM in this case is that it might make performance across browsers and platforms more consistently-optimal. If your JS is already super-tight (and I suspect it is), it probably won't make it much faster in the situations and platforms where it's already fast.

But: if there are some browsers or platforms where your JS underperforms, retooling it in something like AssemblyScript (which is a WASM compiler for TypeScript) might make it more consistently-fast:

https://www.youtube.com/watch?v=njt-Qzw0mVY&t=1375s

@ryansupak2 Why don't you start with a performance profile to find the actual bottlenecks, ideally in a way that can be replicated by others?