Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Annoyingly but predictably, I don't really have any nontrivial code of my own around that doesn't violate any of the (entirely reasonable, except for x509) constraints.

GopherJS happily compiles itself, however. The raw source code looks to be about 250KB. The native binary ends up 7.7MB, and the unminified js is 3MB. A pass through UglifyJS with default options reduces that to 1.7MB (I have not tested the result):

    ~/gocode/bin$ ls -lh *gopher*
    -rwxr-xr-x  1 nknight  staff   7.7M Oct 14 14:02 gopherjs
    -rw-r--r--  1 nknight  staff   3.0M Oct 14 14:32 gopherjs.js
    -rw-r--r--  1 nknight  staff   233K Oct 14 14:32 gopherjs.js.map
    -rw-r--r--  1 nknight  staff   1.7M Oct 14 14:41 min-gopherjs.js
    ~/gocode/bin$
Edit: Oh, and the playground example minifies to 300KB:

    ~/gjstest/playground$ ls -lh
    total 1784
    -rw-r--r--  1 nknight  staff   194B Oct 14 14:05 main.go
    -rw-r--r--  1 nknight  staff   536K Oct 14 14:53 main.js
    -rw-r--r--  1 nknight  staff    42K Oct 14 14:53 main.js.map
    -rw-r--r--  1 nknight  staff   300K Oct 14 14:54 min-main.js
    ~/gjstest/playground$


What about after gzip?


About what you'd expect, the playground sample drops to 75KB, and the compiler to 424KB. (Also the native binary gzips to 2MB.)


Very nice finding!




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: