#136·gopherjs

Large file sizes

Author: liamcurryCreated Dec 14, 2014Updated Jan 6, 2026
LabelsenhancementLongTerm

Here are a few simple examples and their generated file sizes:

Filename Source Generated Minified Minified + Gzipped (Level 9)
simple.go 30b 61kb 46kb 12kb
console.go 86b 71kb 53kb 15kb
websocket.go 296b 1.4mb 1.4mb 69kb
websocket_fork.go 296b 78kb 59kb 13kb
websocket_2015-02-03.go 399b 542kb 390kb 96kb

(The huge jump in filesize in websocket.go is because of github.com/dominikh/go-js-dom)

There are a lot of implementation details in the generated files that shouldn't be there. For example, I would assume that:

go
console.Log("hello")

would compile to:

go
console.log("hello")

but instead it compiles to:

go
console.Log(new ($sliceType($emptyInterface))([new $String("hello")]));

I'd love to start using gopherjs in production, but this is a show stopper. Any ideas on how we can fix this?

edit: added gzipped sizes edit: added websocket_fork.go to results table edit: added websocket_2015-02-03.go to results table