Remove std::vector<bool> - #3197
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## latest #3197 +/- ##
=======================================
Coverage 72.89% 72.89%
=======================================
Files 441 441
Lines 106366 106364 -2
Branches 17120 17120
=======================================
+ Hits 77536 77538 +2
+ Misses 28553 28549 -4
Partials 277 277 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thank you @fwesselm! Yes please, can you undo the formatting? We are not checking ipx code in the clang format, but it would be good for clarity Also, can you please merge this commit: ec0882b or branch bazel-fail-testlogs-tsan So the tsan logs would be uploaded if the sanitizer fails again? These failures only pop up very rarely and it would be good to investigate them |
…de/HiGHS into removeBooleanVectors
Thank you @galabovaa! I have reverted the format changes and made the merge. |
jajhall
left a comment
There was a problem hiding this comment.
All std::vector<bool> have been replaced, but I've spotted
util/HFactorRefactor.cpp:43: vector has_pivot;
util/HFactorRefactor.cpp:212: vector not_in_bump = has_pivot;
which aren't std::vector, so these should be replace (and written as std::, even if unnecessary!
@jajhall, I made these changes. In general, there are many occurrences of unqualified |
Not for now, as it may create merge conflicts |
|
The following is almost certain to be more trouble that it's worth, but it'd be nice to do something like The problem is that everything would have to include whatever header file would incorporate this definition. If there isn't already such a file, I think it may not be worth doing. |
I see this as having the advantage of clarity, in that the old We have the |
@BenChampion, @jajhall, thanks for your comments! I have added |
I see that you've changed all For clarity, shouldn't the name of |
@jajhall, I hope I did not miss a vector. I have renamed the header. Note that uno tests are failing because they include the old header. |
Ah, I'd not considered that The name change should be reverted, and |
I have reverted the move and added a new header |
… and changed std::vector<char> failure(k, 0); to std::vector<HighsBool> failure(k, false); in FactorHighsSolver.cpp
The only occurrences of the string I've been through the use of There are places in the MIP solver where, I guess, I've added comment to util/HighsType.h about the motivation for HighsBool, and (@filikat) changed So, unless there are any further queries, this is good to go! |
|
@jajhall that's correct. There's a fair few The PR is good to go from me! |
|
@galabovaa, should I revert the change to |
BenChampion
left a comment
There was a problem hiding this comment.
Very nice change! Thanks for going the extra 1.6 km with the changes from 0/1 to true/false and 1 - ... to !...
Perhaps a bit paranoid, but it seems worth performance-testing this change, just to be sure. (My expectation is no change. This is just to catch any weird hard-to-foresee stuff, like how the compiler optimizes HighsBool -> bool and bool -> HighsBool, any memory alignment differences, that sort of thing.)
My instinct is that the overhead of using these boolean vectors is very small, so the change in the way that they are represented is of no consequence. If we're ever in any doubt, we can rename With my own paranoia, I also did a search for "class" and "bool" in the same line of HiGHS in case there was an "enum class Name : bool" anywhere that might be used to type an I did spot that there are many |
Replace
std::vector<bool>bystd::vector<uint8_t>.I noticed that the format of some files was changed. I can undo this if needed.