Open rpodgorny opened 1 year ago
Don't know if it is at any help, but you can get a small reduction by using the strip flags when building.
we are already building with -s -w
, see https://github.com/charmbracelet/meta/blob/main/goreleaser-full.yaml
we could run upx
on it after the build, would shave it from 26M to ~4.5M
I'll integrate upx into goreleaser so we can easily run it on our builds :)
this is first few lines of "goweight":
14 MB github.com/yuin/goldmark-emoji/definition
11 MB runtime
5.2 MB github.com/alecthomas/chroma/v2/lexers
3.8 MB golang.org/x/sys/unix
2.6 MB github.com/alecthomas/kong
2.6 MB reflect
2.6 MB github.com/yuin/goldmark/util
2.2 MB github.com/yuin/goldmark/ast
1.9 MB math/big
1.7 MB github.com/charmbracelet/lipgloss
1.7 MB syscall
1.7 MB github.com/yuin/goldmark/parser
1.4 MB github.com/alecthomas/chroma/v2
1.4 MB text/template
1.3 MB github.com/dlclark/regexp2/syntax
1.3 MB encoding/json
1.3 MB text/template/parse
1.2 MB github.com/yuin/goldmark/extension/ast
1.2 MB go/ast
1.2 MB golang.org/x/net/html
1.1 MB github.com/yuin/goldmark/extension
1.1 MB internal/abi
1.1 MB os
1.1 MB time
1.1 MB github.com/microcosm-cc/bluemonday/css
1.1 MB github.com/charmbracelet/bubbletea
1.1 MB encoding/xml
882 kB github.com/muesli/termenv
831 kB fmt
806 kB go/doc
773 kB regexp/syntax
753 kB github.com/charmbracelet/glamour/ansi
746 kB internal/reflectlite
741 kB github.com/charmbracelet/bubbles/textarea
728 kB github.com/dlclark/regexp2
718 kB regexp
671 kB internal/poll
618 kB github.com/microcosm-cc/bluemonday
617 kB go/doc/comment
610 kB compress/flate
595 kB math
591 kB github.com/lucasb-eyer/go-colorful
...the question then is: do we really need 14 megabytes of emojis? ;-)
@rpodgorny I believe it is a dependency of goldmark, which we use to render markdown in gum format
for example.
running upx helps though, from 27mb to 6.9, but it might break on some systems (I remember there's an issue open for latest macos, and a newer one is coming out soon!), so maybe we do that (and test) on linux only if we assess its safe 🤔
Looking at the assets of the latest release -- all <5MB -- it seems this has been fixed! 😀 🎉
Looking at the assets of the latest release -- all <5MB -- it seems this has been fixed! 😀 🎉
not really sure what you're referring to but the "gum version 0.14.5 (1917023)" binary on my arch linux system is currently ~20MB. while much better than before, this is still far from ideal. :-(
Oh my, you're right, my bad. I was looking at these:
The extracted binary is, indeed, ≈20MB of size. A binary that compresses by a factor of five, was not expecting that. 🤔
this tool is cool! really! ...but the binary is huge. :-( ...that makes embedding it really painful. ...is there a way to reduce the binary size?