Hacker News new | ask | show | jobs
by rockwotj 1014 days ago
FWIW we simulate exports by instead having `main` call an imported function that blocks until it's ready to return with the needed data.

So instead of:

`host -> call foo on guest -> return to host`

`host -> call guest main -> call foo on host -> host returns when ready -> guest calls foo when done`

FWIW the scheduler (so goroutines) don't work in go if you're not calling from an main, so anytime you call a custom export then try to use a goroutine you'll get panics.

10x size is about the blowup we see as well. It's also likely to be slower (some of the Tinygo authors said ~20% slowdown compared to tinygo) probably due to the simpler/smaller runtime and LLVM being better at optimizing.

1 comments

The only time I tried wasm in Go, the wasm compiled by the native Go was so slow that the equivalent Javascript was faster. Tinygo produced decent performance however.