bytecodealliance / wit-bindgen

A language binding generator for WebAssembly interface types
Apache License 2.0
1k stars 191 forks source link

Go bindgen todos #499

Open Mossaka opened 1 year ago

Mossaka commented 1 year ago

I would like to initiate a new tracking issue to categorize all the necessary steps in improving the Go bindgen experience. These steps will be divided into three categories: short-term, middle-term, and long-term. The duration of each term is not precisely defined at this point, but short-term goals would be tackled immediately after the merge of PR #471 into the main branch. Long-term goals are expected to be completed beyond 2023, while middle-term goals fall somewhere in between.

Short Term

Middle Term

Long Term

Mossaka commented 1 year ago

Performance-wise, I have done some rudimentary benchmark tests on a standard HTTP server that dispatches each HTTP request to a wasm component compiled from Rust and TinyGo. Here is the result:

Rust

image

TinyGo

image

You can see that the Rust compiled Wasm component's throughput is three times that of TinyGo. I suspect that the performance difference largely is contributed by the double copy of memory in type conversion between Go and C.

patrickhuber commented 1 year ago

I've done some porting of the python component model MVP to pure go here: https://github.com/patrickhuber/go-wasm/tree/6015b8d07aaa1fc902fee44b01d1ebd6fded3d65/abi

More tests are needed for records, variants etc but strings and basic types are working.

Mossaka commented 1 year ago

@patrickhuber glad to hear! Let me know if you ran into any issues.

patrickhuber commented 1 year ago

I completed the unit tests suite included in the component model MVP. I'm going to try to replace some of the generated code with the go abi I created and see what challenges I run into. Latest here: https://github.com/patrickhuber/go-wasm/tree/main/abi

Mossaka commented 1 year ago

Awesome!! @patrickhuber