-
Notifications
You must be signed in to change notification settings - Fork 22
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 (#596)
* Use the local "builder" version When running the tests for the sample-plugin, the "builder" plugin needs to be installed. However, it may happen that there was a change in the sample-plugin Makefile and the builder plugin code. This means we must use the local "builder" version and not the one currently published to the central repository. This commit does this by: 1. building the "builder" plugin under bin/ 2. using bin/builder to build the "builder" plugin so it can be installed under the tanzu CLI Signed-off-by: Marc Khouzam <[email protected]> * Optimize 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 described below. Note that these optimizations are done directly within the builder plugin and not as part of the "plugin-tooling.mk.tmpl" file. This approach will make it easier for plugin authors to get their hands on these improvements, without having to update their copy of the "plugin-tooling.mk" file (which they may not do very often). 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]> --------- Signed-off-by: Marc Khouzam <[email protected]>
- Loading branch information
1 parent
d1ab769
commit 6f528f5
Showing
9 changed files
with
111 additions
and
7 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
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