[libcxx-commits] [PATCH] D144478: [libc++][NFC] Simplify __sort{4, 5}

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 21 09:07:50 PST 2023


Mordante accepted this revision.
Mordante added a comment.
This revision is now accepted and ready to land.

Nice catch! LGTM!

Did you happen to benchmark the performance difference?



================
Comment at: libcxx/include/__algorithm/sort.h:49
 _LIBCPP_HIDE_FROM_ABI
 _LIBCPP_CONSTEXPR_SINCE_CXX14 unsigned __sort3(_ForwardIterator __x, _ForwardIterator __y, _ForwardIterator __z,
                                                _Compare __c) {
----------------
I would be tempted to return a bool instead, it seems `__nth_element` only cares about whether or not a swap is done. (Obviously something for a separate patch.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144478/new/

https://reviews.llvm.org/D144478



More information about the libcxx-commits mailing list