Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client-sdk: use tinygo to compile to wasm #370

Open
tiero opened this issue Nov 6, 2024 · 5 comments
Open

client-sdk: use tinygo to compile to wasm #370

tiero opened this issue Nov 6, 2024 · 5 comments
Assignees

Comments

@tiero
Copy link
Member

tiero commented Nov 6, 2024

No description provided.

@sekulicd
Copy link
Collaborator

sekulicd commented Nov 6, 2024

@tiero can you explain problem with standard go we already using? what should be solved by this?

@tiero
Copy link
Member Author

tiero commented Nov 6, 2024

The WASM is 35MB. The limit on Cloudflare Pages is 25MB. Due to his popularity we expect many other users to want to host JS apps that uses Ark SDK there.

@bordalix
Copy link
Collaborator

bordalix commented Nov 6, 2024

@sekulicd the problem is: ark-sdk.wasm is >35MB in size:

  • We host the clients on Cloudflare's Pages
  • Cloudflare's Pages does not allow files >25MB in size
  • This means we need to host the wasm file in a different service
  • Which is a pain when developing with quick iterations

A different approach would be to build the wasm into different files:

  • 7 files with 5MB each is ok, one with 35MB is not
  • I think is possible to divide the go code into into modules and then generate different wasm files

@tiero
Copy link
Member Author

tiero commented Nov 6, 2024

I would give TinyGo a chance, looking into possible optimizations https://tinygo.org/docs/guides/optimizing-binaries/

Other option is also to use compression when compiling and then decompressing in the browser

https://github.com/httptoolkit/brotli-wasm
https://pkg.go.dev/github.com/google/brotli

@sekulicd
Copy link
Collaborator

@tiero @bordalix update on this: TinyGo doesnt support native net/http pkg, there is ported https://github.com/tinygo-org/net pkg but replacing standard pkgs with TinyGo doesnt seem nice option?
Tried with compressing but didnt make it work yet, will try more.

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

No branches or pull requests

3 participants