[libcxx-commits] [PATCH] D63063: Bug 42208: speeding up std::merge
Denis Yaroshevskiy via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Jun 22 09:53:05 PDT 2019
dyaroshev added a comment.
Unfortunately switch based solution didn't work out - the degradation of 10% is not evenly distributed and, in fact, the results are even significantly worse than current implementation for the case when right hand side.
I tested for this benchmark: https://github.com/DenisYaroshevskiy/merge_biased_blog_post/blob/c8fb78cf17db9ac181d4c6f80cfda32731c5a043/merge_benchmark.cc#L160
Benchmark works like this: I have 2000 64 bit integers. I go every 50 elements and split them in 2 arrays. (starting with 1 one having 2000 integers, finishing with the second one having 2000 integers).
Here are screenshots of my results on the plot:
1. https://pasteboard.co/IkCkqzy.png
2. https://pasteboard.co/IkCnttt.png
(pointing out 2 different data points).
When the second array is dominating, we get a 1.9 loss in performance.
Reproducing same effect on quick-bench: http://quick-bench.com/KHWe2sC-XlYky4oX-g7YaTV7cog (same benchmark that I posted previously, I just adjusted array sizes) - 1.5 time difference.
So, unfortunately, I don't think that proposed switch based solution is good enough.
Would be really great to generate 'goto' version of the loop somehow.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63063/new/
https://reviews.llvm.org/D63063
More information about the libcxx-commits
mailing list