From 315671b7c40a0ccf6dfd2f76f31aacc1efc026fa Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Wed, 4 May 2022 14:58:18 -0700 Subject: [PATCH 1/3] remove transition from `/Os` option in version 19.32.31328, /Os results in binary size savings of 102K in the release DLL (that's 15.5% savings) --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bf83f51ae6b..604527fea87 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,7 +59,12 @@ add_compile_definitions( add_compile_options(/diagnostics:caret /W4 /WX /w14265 /w15038 /d1FastFail /guard:cf /Z7 /Gy /Zp8 /std:c++latest /permissive- /Zc:threadSafeInit- /Zl) set(VCLIBS_DEBUG_OPTIONS "/Od") -set(VCLIBS_RELEASE_OPTIONS "/O2;/Os") # TRANSITION: Potentially remove /Os + +# TRANSITION: potentially remove /Os if it results in speed improvements (requires benchmarking!) +# in version 19.32.31328, /Os results in binary size savings of 102K in the release DLL +# (that's 15.5% savings) +# so make certain that that tradeoff is measured when removing `/Os` +set(VCLIBS_RELEASE_OPTIONS "/O2;/Os") set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR_AMD64}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR_AMD64}") From 112f118b6e9c0194c4bd0a6517d3062909691343 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Wed, 4 May 2022 15:25:38 -0700 Subject: [PATCH 2/3] casey CR --- CMakeLists.txt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 604527fea87..dd8524dc322 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,11 +60,13 @@ add_compile_options(/diagnostics:caret /W4 /WX /w14265 /w15038 /d1FastFail /guar set(VCLIBS_DEBUG_OPTIONS "/Od") -# TRANSITION: potentially remove /Os if it results in speed improvements (requires benchmarking!) -# in version 19.32.31328, /Os results in binary size savings of 102K in the release DLL -# (that's 15.5% savings) -# so make certain that that tradeoff is measured when removing `/Os` -set(VCLIBS_RELEASE_OPTIONS "/O2;/Os") +# TRANSITION: Potentially remove `/Os` if it results in speed improvements. +# This requires benchmarking! +# Note that in MSVC version 19.32.31328, +# `/Os` results in a binary size difference of 102K +# in the release DLL (a gain of 18.4%). +# So, make certain that that tradeoff is considered when or if `/Os` is removed. +set(VCLIBS_RELEASE_OPTIONS /O2 /Os) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR_AMD64}") set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR_AMD64}") From a6ba293a320e7eba28d54358690bdd79d2c0990a Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Wed, 4 May 2022 22:22:43 -0700 Subject: [PATCH 3/3] Cite the tracking issue. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd8524dc322..66eaefb8a9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ set(VCLIBS_DEBUG_OPTIONS "/Od") # `/Os` results in a binary size difference of 102K # in the release DLL (a gain of 18.4%). # So, make certain that that tradeoff is considered when or if `/Os` is removed. +# See GH-2108 for more info. set(VCLIBS_RELEASE_OPTIONS /O2 /Os) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/out/lib/${VCLIBS_I386_OR_AMD64}")