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 Binary Size #1909

Open
falco467 opened this issue May 28, 2024 · 3 comments
Open

Reduce Binary Size #1909

falco467 opened this issue May 28, 2024 · 3 comments

Comments

@falco467
Copy link

Description
Using excelize in a go binary increases the size by 17 MB. This is by far the biggest dependency in our eco-system. Is there any way to decrease the binary size?

Go Build should remove unneeded parts with dead code analysis. Are there maybe big static tables of strings or other data, which are included in the source code and bloat ob the binary? Maybe they could be moved to a sub-folder or behind build-tags, so users who don't need them can exclude them?

@paolobarbolini
Copy link
Contributor

This could be caused by uses of the reflect package, which for some methods disables dead code analysis because of the compiler not being able to figure out what reflect may want to access.

@falco467
Copy link
Author

falco467 commented Jun 3, 2024

@paolobarbolini the reflect package has received an update a while ago, where it will not block dead code analysis, if it can determine the strings user as function names at compile time. Maybe some simplification in how the strings for the reflect calls are created could enable the compiler to predict what values will be used?

Are there any other big generated data-structures in the library?

@tdewolff
Copy link

This is indeed a surprisingly large dependency, could this be improved somehow? Is it really due to the reflect package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants