Turn on LTCG and COMDAT folding. #1820
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=12598442&view=logs&j=4cdc4065-f43d-507c-ee4e-5b139a5033dc&t=78a6c2bd-8a92-57c2-fdda-4275d0cbc2ca
D:\a_work\1\a\drop\vcpkg.exe: warning BA6004: 'vcpkg.exe' was compiled with COMDAT folding (/OPT:ICF) disabled, increasing binary size. For VC projects use ItemDefinitionGroup - Link - EnableCOMDATFolding property with 'true' value. D:\a_work\1\a\drop\vcpkg.exe: warning BA6005: 'vcpkg.exe' was compiled with Optimize References (/OPT:REF) disabled, increasing binary size. For VC projects use ItemDefinitionGroup - Link - OptimizeReferences property with 'true' value. D:\a_work\1\a\drop\vcpkg.exe: warning BA6006: 'vcpkg.exe' was compiled without Link Time Code Generation (/LTCG). Enabling LTCG can improve optimizations and performance. For VC projects use WholeProgramOptimization property with 'true' value.
On my local testing this reduces vcpkg.exe from 8MB to 5MB.