[clang-tidy] New patterns for performance-inefficient-algorithm check
BEFORE:
auto search(std::set<int> s, int i) {
return std::find_if(s.begin(), s.end(), [&](int val) {
return val > i;
});
}
AFTER:
auto search(std::set<int> s, int i) {
return it->second.upper_bound(i);
}
Complexity drops from O(n) to O(log n).
Also we can use lower_bound for <= in this check.
@llvm/issue-subscribers-clang-tidy
Author: Denis Mikhailov (denzor200)
AFTER:
auto search(std::set<int> s, int i) {
return it->second.upper_bound(i);
}
Complexity drops from O(n) to O(log n).
Also we can use lower_bound for <= in this check.
Also std::map has upper_bound and lower_bound methods. Flat versions also should be included
We have check https://clang.llvm.org/extra/clang-tidy/checks/performance/inefficient-algorithm.html, this is probably what you want. If some patterns/containers are missing, they should be added there.
We have check https://clang.llvm.org/extra/clang-tidy/checks/performance/inefficient-algorithm.html, this is probably what you want. If some patterns/containers are missing, they should be added there.
Oke, I will update description later
@EugeneZelenko this is not Check Request anymore, could you please update labels?
I can try this