[libcxx-commits] [PATCH] D141205: [libcxx] nth_element use introselect to avoid quadratic behavior

Zhikai Zeng via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jan 7 12:00:48 PST 2023


Backl1ght created this revision.
Backl1ght added reviewers: ldionne, danlark, philnik.
Backl1ght added a project: libc++.
Herald added a project: All.
Backl1ght requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

Current implementation of nth_element will be quadratic under some cases, use introselect to avoid quadratic behavior.

I also add a benchmark for nth_element.

related issue https://github.com/llvm/llvm-project/issues/52747


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141205

Files:
  libcxx/benchmarks/CMakeLists.txt
  libcxx/benchmarks/algorithms/common.h
  libcxx/benchmarks/algorithms/nth_element.bench.cpp
  libcxx/include/__algorithm/nth_element.h
  libcxx/include/__algorithm/sort.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141205.487113.patch
Type: text/x-patch
Size: 6876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230107/4a29139f/attachment.bin>


More information about the libcxx-commits mailing list