-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip CLI and plugin binaries to reduce their size
Overall binary reduction achieved by this commit: - 28% decrease for Darwin - 36% decrease for Linux and Windows This commit does two optimizations: 1. Remove symbol tables (reduce about 30% for Linux/Windows, 22% for Mac) -- When compiling the CLI and plugins, this commit adds the "-s" and "-w" flags. The "-s" flag omits the symbol table and debug information while "-w" omits the DWARF symbol table. These symbol tables are used by debuggers. The impact in removing them will be that it will not be possible to use a debugger on a production binary; this is acceptable and it is actually a standard approach to ship production binaries without debug symbols. If a debugger needs to be used, a binary can built with the symbol tables. Note that the removal of debug symbols does not prevent proper traces from being shown in a go "panic". To build a CLI with debug symbols use TANZU_CLI_ENABLE_DEBUG=1 To build plugins with debug symbols use PLUGIN_ENABLE_DEBUG=1 2. Disable function inlining (reduce about 6% on every OS) -- Adding the flag "-gcflags=all=-l" removes function inlining. This normally reduces performance a little but saves space. Considering we are dealing with a CLI tool which does not perform CPU intensive operations, the slight possible performance degradation is not of concern. Signed-off-by: Marc Khouzam <[email protected]>
- Loading branch information
1 parent
60a0903
commit 133f611
Showing
6 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters