Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would wasm make it any faster? #102

Open
ryansupak2 opened this issue Nov 1, 2020 · 3 comments
Open

Would wasm make it any faster? #102

ryansupak2 opened this issue Nov 1, 2020 · 3 comments

Comments

@ryansupak2
Copy link

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?

@desandro
Copy link
Member

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.

@ryansupak2
Copy link
Author

ryansupak2 commented Nov 27, 2020

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

@mootari
Copy link

mootari commented Nov 28, 2020

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants