-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc++] Run the test suite with optimizations by default #118006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In production, libc++ is used with optimizations enabled 99.9% of the time. Therefore, I think it makes sense to run our tests with optimizations enabled by default, to be closer to what people actually use in production. It's still possible to disable optimizations for debugging purposes or other reasons. This also removes the pitfall of trying to run the benchmarks but forgetting to set the optimization level.
|
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesIn production, libc++ is used with optimizations enabled 99.9% of the time. Therefore, I think it makes sense to run our tests with optimizations enabled by default, to be closer to what people actually use in production. It's still possible to disable optimizations for debugging purposes or other reasons. This also removes the pitfall of trying to run the benchmarks but forgetting to set the optimization level. Full diff: https://github.com/llvm/llvm-project/pull/118006.diff 1 Files Affected:
diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py
index 2c5cb169c0a9a3..8ecd1a32799a31 100644
--- a/libcxx/utils/libcxx/test/params.py
+++ b/libcxx/utils/libcxx/test/params.py
@@ -193,7 +193,7 @@ def getSuitableClangTidy(cfg):
choices=["none", "speed", "size"],
type=str,
help="The optimization level to use when compiling the test suite.",
- default="none",
+ default="speed",
actions=lambda opt: filter(None, [
AddCompileFlag(lambda cfg: getSpeedOptimizationFlag(cfg)) if opt == "speed" else None,
AddCompileFlag(lambda cfg: getSizeOptimizationFlag(cfg)) if opt == "size" else None,
|
|
This significantly increases the time it takes to run the testsuite and might actually be detrimental to finding bugs, since the sanitizers tend to be less effective due to the optimizer removing UB in some cases. What is the benefit here? |
The benefit is that we're testing what people actually ship in production. I'd be OK with not making it the default, but I think we should at least have a job that enables optimizations. For example, it looks like this breaks the CI as-is. |
Shouldn't the |
I didn't remember that we already had that. That solves most of my concerns. If I had remembered that, I don't think I'd have created this patch. |
In production, libc++ is used with optimizations enabled 99.9% of the time. Therefore, I think it makes sense to run our tests with optimizations enabled by default, to be closer to what people actually use in production. It's still possible to disable optimizations for debugging purposes or other reasons.
This also removes the pitfall of trying to run the benchmarks but forgetting to set the optimization level.