Looks like the binary size optimization flags are not ideal when compiling with 
MSVC.
On other compilers (gcc/clang) the current size optimization flags lead in most 
cases to smaller libraries. On MSVC this seems to be not the case, the libs 
often get larger when optimizing for SIZE.

For example jvm.dll (build with VS2022) with current -Os size optimization
20M images/jdk/bin/server/jvm.dll

with -O1 set for size optimization
13M images/jdk/bin/server/jvm.dll

See the doc from MSVC about "optimize for size"
https://learn.microsoft.com/en-us/cpp/build/reference/o1-o2-minimize-size-maximize-speed?view=msvc-170
"The /O1 option sets the individual optimization options that create the 
smallest code in the majority of cases."
The Os option is only a part of the size minimization flag set :
/O1 (Minimize Size) equivalent to /Og /Os /Oy /Ob2 /GF /Gy

-------------

Commit messages:
 - JDK-8349214

Changes: https://git.openjdk.org/jdk/pull/23432/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23432&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8349214
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/23432.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23432/head:pull/23432

PR: https://git.openjdk.org/jdk/pull/23432

Reply via email to