Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
extism
The framework for building with WebAssembly (wasm). Easily load wasm modules, move data, call functions, and build extensible apps.
-
octosql
OctoSQL is a query tool that allows you to join, analyse and transform data from multiple databases and file formats using SQL.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
so as for the first question, I'll refer to Adrian's reply on an older thread https://news.ycombinator.com/item?id=31415317
as for the second, I'll have to be honest and tell that I am the n00b of the team and I don't know the answer :D
I can refer you to this possibly related doc https://github.com/tetratelabs/wazero/blob/main/RATIONALE.md... and then my awesome team mates might get back to you with a proper answer later when they wake up :^)
you mean like this? https://github.com/knqyf263/go-plugin ;)
wazero under the hood, by one of our awesome community members
CUE recently added initial WASM support, glad to see it was this library!
https://github.com/cue-lang/cue/blob/0520a3f9e73e63d77e43c9b...
Never got it to anything close to a finished state, instead moving on to doing the same prototype in llvm and then cranelift.
That said, here's some of the wazero-based code on a branch - https://github.com/cube2222/octosql/tree/wasm-experiment/was...
It really is just a very very basic prototype.
There are a few, but I suspect the most widely used would be wasmtime. It's written in Rust and can be used from Go [2] but requires CGo (as mentioned by GP).
[1] https://github.com/bytecodealliance/wasmtime
[2] https://github.com/bytecodealliance/wasmtime-go
Using WASM for things requiring low IO and high compute that are traditionally written in C/C++ makes a lot of sense to me. Image codecs are an example and native implementations for things like JPEG encoders are hard to come by. So, I used wazero to implement a few image codecs in Go^1. Codecs were compiled to WASM, and wazero works great for running them (albeit with overhead).
For this use case, wazero appears to be the cleanest solution as it's the only runtime that doesn't need CGo. The biggest appeal to me embedding WASM in Go is avoiding CGo to allow cross compilation. If my dependency is using CGo anyway, I might as well as link against a C library. I think native WASM runtimes like wazero are currently the best options for porting code language-agnostically.
^1: https://github.com/yklcs/wasmimg