[libcxx-commits] [libcxx] [libc++] Speed up set_intersection() by fast-forwarding over ranges of non-matching elements with one-sided binary search. (PR #75230)
Iuri Chaer via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 30 05:45:43 PDT 2024
ichaer wrote:
I've deleted my old comment about inconsistent benchmark results to avoid misleading others with my bad conjectures. The real reason benchmark results were inconsistent was the fact that we use randomly-generated data as input, and, embarrassingly, it hadn't occurred to me to seed the random number generators involved with hardcoded values before producing results for a before-and-after comparison. Given a large enough sample, and if we were looking only at the results in aggregate, we'd expect that not to make a difference, but samples were not large enough (especially for the larger runs), and I was comparing test cases independently, so comparison results were surprising at times.
What I've done to produce the comparison results shared in the PR comment was use a hardcoded value of 0 as the seed for `getRandomEngine()` in `libcxx/benchmarks/GenerateInput.h`. I'm attaching the json benchmark results here in case anyone is interested in looking at the full thing without having to run it themselves.
[onesided-be6c5c848d.json](https://github.com/llvm/llvm-project/files/15163968/onesided-be6c5c848d.json)
[main-b926f75e89.json](https://github.com/llvm/llvm-project/files/15163972/main-b926f75e89.json)
https://github.com/llvm/llvm-project/pull/75230
More information about the libcxx-commits
mailing list