Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

WebAssembly #33

Open
DrJosh9000 opened this issue Dec 5, 2018 · 4 comments
Open

WebAssembly #33

DrJosh9000 opened this issue Dec 5, 2018 · 4 comments
Assignees
Milestone

Comments

@DrJosh9000
Copy link
Contributor

The bulk of the UI is still built with GopherJS.
The WebAssembly compiler might be ready.

@DrJosh9000 DrJosh9000 added this to the v1 milestone Dec 5, 2018
@DrJosh9000 DrJosh9000 self-assigned this Dec 5, 2018
@ghost
Copy link

ghost commented Dec 7, 2018

the standard golang WASM uses a ton of ram.

I have been using tinyGO that has WAMS support.
https://github.com/aykevl/tinygo/tree/master/src/examples/wasm

Tinygo is amazing... Really should try it.


Also i was thinking that running the golang WASM code inside WebWorkers is a smart way to go, so that the GUI thread is freed up. Anything you built you would want to be that way.
Also its follows the architectural patterns because its pure message passing between the WebWorkers and the main Window and its all asynchronous.
Basic overview here: https://blog.sessionstack.com/how-javascript-works-the-building-blocks-of-web-workers-5-cases-when-you-should-use-them-a547c0757f6a

This would allow people to build HTML GUI apps with shenzen and have all the logic inside the Webworkers doing whatever pipelines are needed. The GUI would be updated based on the results of any computation.

i would consider using a dependency on CommLink also to abstract it a little. But it might be overkill too. Commlink handles the aspects of communication between the Window and the Webworkers.
https://github.com/GoogleChromeLabs/comlink

@DrJosh9000
Copy link
Contributor Author

For now I'm more concerned that GopherJS might become unusable - e.g. gopherjs/gopherjs#855 means that to rebuild the client one can't be doing things the module way. It's another command that needs to be installed locally, but Go WASM has the benefit of being built into Go.

TinyGo is promising. I think some Go features are in use that TinyGo isn't supporting yet, so we'll see.

@DrJosh9000
Copy link
Contributor Author

A few days ago I started experimenting in the wasm branch. After many minor code fixes, it compiles and runs up to the point of displaying a graph. Sadly UI interaction is broken after that point; the client crashes inside github.com/johanbrandhorst/protobuf which is still based on GopherJS. From a very quick look, Johan's packages don't look too difficult to port to syscall/js...

@DrJosh9000
Copy link
Contributor Author

Good thing I didn't keep going down that path, because of course github.com/johanbrandhorst/grpcweb-wasm-example exists already.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant