[libcxx-commits] [PATCH] D63063: Bug 42208: speeding up std::merge
Denis Yaroshevskiy via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 18 15:32:30 PDT 2019
dyaroshev added a comment.
After multiple attempts I could not make the "if/switch" based version to produce a similar result.
Since there doesn't seem to be "is_constant_evaluated" in clang, I cannot write a constexpr enabled version of this function.
I can report this as an optimiser bug, if that would be useful.
@EricWF
I did 2 things:
1. I only check the boundary for just adjusted iterator. This gives me up to 30% speedup for some cases.
2. I restructured the loop that we do less jumps: std::merge jumps back for each element, I don't. + The loop for the second array dominating is a lot like a do while loop, this might be helpful.
I do not know enough about the CPU to know how correct this explanation is but I do know that I have reproduction of this speed up on multiple different machines.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63063/new/
https://reviews.llvm.org/D63063
More information about the libcxx-commits
mailing list