←back to thread

153 points yar-kravtsov | 5 comments | | HN request time: 0.654s | source

I built a Vite plugin that lets you write Go code directly in .js files using a "use golang" directive. It compiles to WebAssembly automatically.
Show context
pjmlp ◴[] No.45718527[source]
Cool hack, just use JavaScript.
replies(2): >>45718573 #>>45718617 #
1. Cthulhu_ ◴[] No.45718617[source]
99 times out of a hundred, sure. But sometimes you need better performance or a library that isn't available in JS.
replies(3): >>45718843 #>>45718863 #>>45720349 #
2. pjmlp ◴[] No.45718843[source]
WebGPU or WebGL is the answer.
replies(1): >>45720060 #
3. hollowturtle ◴[] No.45718863[source]
Better performance? For javascript code that calls into native platform apis provided by the browser it's been alteady proven that performance is an order of magnitude better than calling into wasm and doing all the sheningans to move bytes from and to wasm
4. dgb23 ◴[] No.45720060[source]
I second that, having just relatively recently used the native browser APis for image processing. While it felt a bit awkward to use, it served its purpose pretty well.

If I needed more, I would probably not use Go anyways, but a sharper tool instead.

5. ramses0 ◴[] No.45720349[source]
Or even "use server.physics.go", which is where my mind went to (and where I've messed around with language interoperability with tinygo before).

This is such a wonderfully blursed and "smooth" implementation!