cblgh / cerca

lean forum software
Other
124 stars 18 forks source link

Reducing binary size #65

Closed decentral1se closed 2 months ago

decentral1se commented 2 months ago

Been testing cerca on a few machines and all running smooth! Great work 😌 I ended up scp'ing it around ofc and wanted to see if I could get the size down for this.

I had success with passing -ldflags="-s -w" (remove debug symbols) to go build (from 16M -> 9.7M). And also running upx --lzma cerca got this down to 3.2M. Similar reductions to be had for all the ./cmd/... tools also.

In general, this increases the response time when running the CLI later but since you mostly "set it and forget it", it seems to fit cerca well?

Maybe something for the docs perhaps? Could also be thrown into a Makefile or some script if you're keen. I will deffo be running these commands by hand again, so would be convenient.

cblgh commented 2 months ago

yay glad to hear it's workin!! :] good one on getting the size down!

regarding documenting it, maybe a first step (i don't really use Makefiles atm oops) could be to document the general invocation you used in the readme at the bottom under the "developing" section, as a kind of "building binaries" section? feels like an easy win, then later i can see if commiting a Makefile / shell script makes sense or what. cause iirc upx requires installing separately ya? would like any & all hurdles to be optional rather than be a stumbling block during someone's first interaction 🙏