Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the size of the binary #2109

Open
vdemeester opened this issue Sep 1, 2023 · 5 comments
Open

Reduce the size of the binary #2109

vdemeester opened this issue Sep 1, 2023 · 5 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@vdemeester
Copy link
Member

As of today, tkn is a very big binary.

$ du bin/tkn
147M	bin/tkn
$ strip bin/tkn
$ du bin/tkn
118M	bin/tkn

We should try to find some ways to reduce the size of it somehow 👼🏼 🙏🏼. Some ideas:

  • Track tektoncd/pipeline deps and understand where we can limit pulling k8s.io ones
  • Have our own "struct" representing the types ? (generated)
@vdemeester vdemeester added help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. labels Sep 1, 2023
@chmouel
Copy link
Member

chmouel commented Sep 1, 2023

cleanup deps will be the first thing that come in mind, we have too many dependencies that i am not sure it's worth to have

@vinamra28 vinamra28 added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label May 21, 2024
@aThorp96
Copy link

I don't think this is necessarily the order of magnitude we'd be looking for, but building without DWARF debugging symbols (-ldflags "-w") by about 14%.

@chmouel
Copy link
Member

chmouel commented Jan 22, 2025

we def already do this in released version

https://github.com/tektoncd/cli/blob/main/.goreleaser.yml#L19

@chmouel
Copy link
Member

chmouel commented Jan 23, 2025

fyi the size in 2025 🙃

% rm -f bin/tkn && make bin/tkn
% du bin/tkn
207M	bin/tkn
% rm -f bin/tkn && make bin/tkn FLAGS="-s -w"
% du bin/tkn
147M	bin/tkn

in chatgpt words it's a 40% increase

Image

@aThorp96
Copy link

I took a look at the dependencies used right now. At least around 19M of the indirect dependencies are related to storage backends(?) and signing related libs imported indirectly through tekton/chains. Particularly, envoyproxy/go-control-plane (7.69M), aws-sdk-go (both v1 and v2) (cum. 8.9M), and mongo-driver (2.5M). I don't fully grok yet how components like tekton/chains are used in the CLI, but depending on how they're used it may be possible to omit some of these larger indirect dependencies by cleaning up how the component's modules are structured. In Python there's Optional Dependencies and Rust has Features, I recall Go having strategies to accomplish similar things, but I'm still pretty new to Go dependency management so I don't recall how

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
None yet
Development

No branches or pull requests

4 participants