Thanks.  So those flags knocked about 100kB off the size down to 2.5MB.  
But it seems Kotlin generates a similar sized file ~2.6MB maybe for a 
similar reason i.e. runtime jvm.

I also tried gzip as suggested on the wiki, but my hosting provider always 
delivers the full file :(

But anyway my hosting provider has added support for the application/wasm  
MIME type now :) and I'm now able to use the following to start the app:

<script>
const go = new Go();
WebAssembly.instantiateStreaming(fetch("app.wasm"), go.importObject).then(
async (result) => {
await go.run(result.instance);
});
</script>

I'm, wondering if there is anything special I need to do to 'cleanup' the 
wasm afterwards.  because this runs fine on macos, but doesnt seem to run a 
second time on win7 firefox 65 box without restarting the browser.

I'm using a wait on a Go chan, and using a defer to Release allocated 
FuncOf methods. Am I missing anything else? 

Thanks, Peter



On Wednesday, 27 March 2019 05:42:04 UTC+1, Agniva De Sarker wrote:
>
> You can use "-ldflags='-s -w'" to reduce the size, but it is expected that 
> wasm files will be in the order of MBs (see 
> https://golang.org/doc/go1.11#wasm). 
>
> > So I was wondering if there are tools that parse the .wasm and prune 
> unused pkgs?
>
> The size is not due to unused packages being imported, but rather the 
> runtime and scheduling code. See the relnotes above.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to