Skip to content

Commit

Permalink
Use "real" full optimization flag with MSVC (/O2 instead of /Ox)
Browse files Browse the repository at this point in the history
I agree to license my contributions to each file under the terms given
at the top of each file I changed.
  • Loading branch information
andoalon committed Mar 7, 2023
1 parent 95948b3 commit 4f71e70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down

0 comments on commit 4f71e70

Please sign in to comment.