taylorh140 / typst-pintora

A packaged version of pintora intended as a typst plugin.
10 stars 0 forks source link

Extremely poor performance #2

Open dyc3 opened 2 months ago

dyc3 commented 2 months ago

I've started using this for diagrams in my docs. Previously, I was using mermaid and had a script to render all the figures to svgs ahead of time. Since I've started using this package, the UX is way better, but my build times have shot through the roof. My document only has a few diagrams, and it takes at least 100x longer to build.

$ time just build
typst compile --font-path ./fonts main.typ main.pdf
just build  96.12s user 0.18s system 100% cpu 1:36.24 total
taylorh140 commented 2 months ago

Yes, this is a known issue. It might be fixed some day but is largely due to the fact that the wasm binary's are being interperted using wasmi. I nearly didn't publish this package due to the performance. Luckly, incremental builds should suffer less even though it still isn't fun. Someday this could be fixed upstream and the performance may increase about 100x after a transfer to wasmer. However, this is a tricky implementation, so don't expect it too soon.

This:

https://discord.com/channels/1054443721975922748/1054443722592497796/1197571746061090897

kind of explains it. but there are many similar post about the wasmi performance.

I'll leave this issue open until some magical day when the transfer is done.

dyc3 commented 2 months ago

I'm not in that discord, would you mind posting the text?

taylorh140 commented 2 months ago
And wasmi is probably gonna be replaced with wasmer/something similar in the CLI and native browser wasm execution in the webapp 
Both are gonna be (a lot) faster than  wasmi (which is currently used in both webapp and CLI)
The main blocker for that being the webapp which needs to use the wasm interpreter of the browser which, according to laurmaedje, is a bit of work (and closed source)