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
Comparison expression creation fix #2128
Conversation
Codecov Report
@@ Coverage Diff @@
## devel #2128 +/- ##
==========================================
- Coverage 90.30% 90.28% -0.02%
==========================================
Files 146 146
Lines 7141 7127 -14
==========================================
- Hits 6448 6434 -14
Misses 693 693 |
I compared compilation time with the current master by running these commands:
Compilation time for separate targets I got after one run: Before the change: After the change: Regression in total is around 1.5%, but one run is obviously not statistically significant. |
Compared compilation time again using this command
Before the change:
After the change:
|
That's not good measurement: you explicitly include the time needed to build the static library proper, which is unaffected. However, I've had time to collect some measurements on my own: This PR:
current
So that's difference of roughly 600ms for the median, which is about 3% slowdown over the current status. Not great, not terrible... I will also try what happens if, instead of doing SFINAE for taking things by-value for arithmetic types, we return to the old functionality of only taking bools by value, which should require less work from the compiler to accomplish. e: ok, plain overload won't work due to bitfields, and I assume that's why you went the |
I just realized that the new test is added here, and it would be fair to compare compilation times without this test. |
@horenmar I've learned about the "hidden friends" idiom, so I moved operators inside the class. I repeated your measurements, on my laptop they produce: Current
This PR before the update:
This PR now:
|
Thanks, the new compile time performance looks pretty good. However, I think the change in inferred types is wrong for two reasons:
As to the concern for dangling refs, the critical part of the code is this catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); any temporary created as part of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the main problem, 2 small nitpicks.
Description
Why.
This PR fixes the issue that user-defined operators can be a better match than the ones used to create Catch2 expression (defined in
Decomposer
andExprLhs
).What.
bool
overload where it existed before.GitHub Issues
Closes #2121
Note
I'm sorry for not fully reading the contribution guidelines. I just have a problem and propose a solution. Feel free to edit my code.