In MSVC, /Ox optimization is used by default.
Compared with /Ox, /O2 has these two additional options:
/GF: eliminates duplicate strings
/Gy: does function level linking
A stackoverflow question, it has some doc links:
https://stackoverflow.com/questions/5063334/what-is-the-difference-between-the-ox-and-o2-compiler-options
I tested a CPython module pyzstd, adding /GF reduced the .pyd file size from 642 KB to 641 KB, further adding /Gy reduced to 466 KB (!). It seems no performance loss.
A CPython issue about this:
https://bugs.python.org/issue37794
In MSVC,
/Oxoptimization is used by default.Compared with
/Ox,/O2has these two additional options:/GF: eliminates duplicate strings/Gy: does function level linkingA stackoverflow question, it has some doc links:
https://stackoverflow.com/questions/5063334/what-is-the-difference-between-the-ox-and-o2-compiler-options
I tested a CPython module
pyzstd, adding/GFreduced the .pyd file size from 642 KB to 641 KB, further adding/Gyreduced to 466 KB (!). It seems no performance loss.A CPython issue about this:
https://bugs.python.org/issue37794