diff --git a/build.rs b/build.rs index 5010ddc354..aadb0a43a6 100644 --- a/build.rs +++ b/build.rs @@ -619,7 +619,10 @@ fn cc(file: &Path, ext: &str, target: &Target, include_dir: &Path, out_file: &Pa // run-time checking: (s)tack frame, (u)ninitialized variables let _ = c.flag("/RTCsu"); } else { - let _ = c.flag("/Ox"); // Enable full optimization. + // Enable full optimization. + // Despite popular belief, /Ox enables less optimizations than /O2 + // https://learn.microsoft.com/en-us/cpp/build/reference/ox-full-optimization?view=msvc-170 + let _ = c.flag("/O2"); } }