[libcxx-commits] [PATCH] D112152: [libc++] Unroll loop in std::find_if and define other std::find variants in terms of it

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 20 10:52:19 PDT 2021


Mordante added a comment.

In D112152#3075523 <https://reviews.llvm.org/D112152#3075523>, @ldionne wrote:

> I normally push back against this sort of manual "optimization", but in this case it seems to really make a difference for the case I was told about. We can have a discussion about whether this is an actual improvement. If we end up not taking the change, I'll at least take the test changes.

I also would prefer a compiler can do this kind of transformation when it's beneficial.
Can you add a benchmark so we can measure the performance gains and code size changes?



================
Comment at: libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp:62
 
+int main(int, char**) {
+  test();
----------------
Since the algorithm is no longer straight forward I think it would be good to validate the number of times the predicate is evaluated. Just to make sure we didn't accidentally increase the number of evaluations.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112152/new/

https://reviews.llvm.org/D112152



More information about the libcxx-commits mailing list