[libcxx-commits] [PATCH] D112152: [libc++] Unroll loop in std::find_if and define other std::find variants in terms of it
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 20 09:23:00 PDT 2021
ldionne created this revision.
ldionne requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
It was reported that libstdc++'s std::find was considerably faster than
libc++'s std::find in some cases. This was tracked down to some manual
loop unrolling being done in libstdc++'s implementation.
This patch modifies std::find_if to perform such loop unrolling, and
also modifies std::find and std::find_if_not to call std::find_if
as an implementation detail so they can take advantage of any optimization
we might do in std::find_if.
As a fly-by fix, this commit significantly improves the test coverage for
the three std::find_XXXX algorithms, which was previously insufficient to
find issues in this patch.
rdar://72436671
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112152
Files:
libcxx/include/__algorithm/find.h
libcxx/include/__algorithm/find_if.h
libcxx/include/__algorithm/find_if_not.h
libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp
libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if.pass.cpp
libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112152.380990.patch
Type: text/x-patch
Size: 12667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211020/09369a43/attachment-0001.bin>
More information about the libcxx-commits
mailing list