qax-os / excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
https://xuri.me/excelize
BSD 3-Clause "New" or "Revised" License
17.62k stars 1.68k forks source link

Reduce Binary Size #1909

Open falco467 opened 1 month ago

falco467 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

@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?