<story><title>A Go Package for Building Progressive Web Apps</title><url>https://go-app.dev/</url></story><parent_chain><item><author>oefrha</author><text>One problem with golang&amp;#x27;s wasm target is that the generated binary is huge. For instance, I checked app.wasm of this documentation site and the four examples listed at &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;go-app.dev&amp;#x2F;built-with&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;go-app.dev&amp;#x2F;built-with&lt;/a&gt;:&lt;p&gt;0. This site: 14.9MB, 3.4MB gzipped;&lt;p&gt;1. 13.5MB, 3.2MB gzipped;&lt;p&gt;2. 15.4MB, 3.2MB gzipped;&lt;p&gt;3. 4.7MB, 1.2MB gzipped (this is an extremely bare bones demo);&lt;p&gt;4. 25.0MB, 5.4MB gzipped.&lt;p&gt;You can save a bit more with brotli, but not much more. I built an app with golang wasm last year, but ended up rewriting everything in good old TS since I couldn&amp;#x27;t justify the ~15MB raw, ~2.7MB brotli&amp;#x27;ed payload.&lt;p&gt;I guess you can make some huge savings if tinygo has enough capabilities to cover all your needs. Not sure if it&amp;#x27;s possible with this library, but if it is, they certainly haven&amp;#x27;t explored it, hence the 3.4MB gzipped wasm for a documentation site.</text></item></parent_chain><comment><author>void_mint</author><text>&amp;gt; but ended up rewriting everything in good old TS since I couldn&amp;#x27;t justify the ~15MB raw, ~2.7MB brotli&amp;#x27;ed payload.&lt;p&gt;What were the size improvements?</text></comment>
<story><title>A Go Package for Building Progressive Web Apps</title><url>https://go-app.dev/</url></story><parent_chain><item><author>oefrha</author><text>One problem with golang&amp;#x27;s wasm target is that the generated binary is huge. For instance, I checked app.wasm of this documentation site and the four examples listed at &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;go-app.dev&amp;#x2F;built-with&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;go-app.dev&amp;#x2F;built-with&lt;/a&gt;:&lt;p&gt;0. This site: 14.9MB, 3.4MB gzipped;&lt;p&gt;1. 13.5MB, 3.2MB gzipped;&lt;p&gt;2. 15.4MB, 3.2MB gzipped;&lt;p&gt;3. 4.7MB, 1.2MB gzipped (this is an extremely bare bones demo);&lt;p&gt;4. 25.0MB, 5.4MB gzipped.&lt;p&gt;You can save a bit more with brotli, but not much more. I built an app with golang wasm last year, but ended up rewriting everything in good old TS since I couldn&amp;#x27;t justify the ~15MB raw, ~2.7MB brotli&amp;#x27;ed payload.&lt;p&gt;I guess you can make some huge savings if tinygo has enough capabilities to cover all your needs. Not sure if it&amp;#x27;s possible with this library, but if it is, they certainly haven&amp;#x27;t explored it, hence the 3.4MB gzipped wasm for a documentation site.</text></item></parent_chain><comment><author>chrismorgan</author><text>One thing for old-school performance comparers to remember here is that WASM is very significantly cheaper than JavaScript to parse and compile.&lt;p&gt;On an arbitrary fairly weak phone, 15MB of WASM might take two seconds to compile, but it can do that &lt;i&gt;while downloading&lt;/i&gt;, so that in practice your network link will probably be the limiting factor. So the transfer size is typically the figure to care about and the uncompressed size actually doesn’t matter all that much.&lt;p&gt;15MB of JavaScript on that same device might take ten seconds or even more to compile, and it largely can’t even start until it’s finished downloading it. Consequently, you need to care about both the transfer size and the uncompressed size, in different ways.&lt;p&gt;(My figures are super dodgy as I can’t find any recent concrete figures, but they should be in vaguely the right ballpark.)&lt;p&gt;This is all about comparing just the cost to the &lt;i&gt;CPU&lt;/i&gt;; data transfer costs money too and takes time, and several megabytes transferred is inconvenient to many for reasons of cost or time, and decidedly wasteful.&lt;p&gt;Multiple megabytes even of WASM is still madness and folly for simple stuff like this, severely restricting its potential usefulness. Thank you for deciding not to ship something like that yourself.</text></comment>