[libcxx-commits] [libcxx] Libcxx nth element small ranges (PR #215698)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 12 06:04:28 PDT 2026
================
@@ -84,6 +84,55 @@ int main(int argc, char** argv) {
register_bm(support::single_element_data<int>, "repeated");
}
+ // Benchmark std::nth_element on many independent fixed-size windows. This models
+ // the median-of-3 / median-of-5 filter use case from #214238, where the window
+ // size is a compile-time constant and the specialized sorting-network path is
+ // expected to constant-fold away the general algorithm.
----------------
ldionne wrote:
This comment is nice, but it's a bit too tied to our internal implementation. For context, the test suite (and benchmark suite) strive to also be usable by other standard libraries, so we try to frame things as generically as possible (within reason).
```suggestion
// Benchmark std::nth_element on many small sequences whose size is known
// at compile-time. Fast implementations exist for these cases.
```
https://github.com/llvm/llvm-project/pull/215698
More information about the libcxx-commits
mailing list