Skip to content

Commit 0fb76ba

Browse files
authored
Reapply "[libc++] Simplify the implementation of std::sort a bit (#104902)" (#114023)
This reverts commit ef44e46. The patch was originally reverted because it was deemed to introduce a performance regression for small inputs, however it also fixed a previous performance regression for larger inputs. So overall, this patch is desirable.
1 parent f7b5f0c commit 0fb76ba

File tree

8 files changed

+150
-171
lines changed

8 files changed

+150
-171
lines changed

libcxx/include/__algorithm/comp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ struct __less<void, void> {
4242
}
4343
};
4444

45+
template <class _Tp>
46+
inline const bool __desugars_to_v<__less_tag, __less<>, _Tp, _Tp> = true;
47+
4548
template <class _Tp>
4649
inline const bool __desugars_to_v<__totally_ordered_less_tag, __less<>, _Tp, _Tp> = is_integral<_Tp>::value;
4750

libcxx/include/__algorithm/ranges_minmax.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct __minmax {
8989
// vectorize the code.
9090
if constexpr (contiguous_range<_Range> && is_integral_v<_ValueT> &&
9191
__is_cheap_to_copy<_ValueT> & __is_identity<_Proj>::value &&
92-
__desugars_to_v<__totally_ordered_less_tag, _Comp, _ValueT, _ValueT>) {
92+
__desugars_to_v<__less_tag, _Comp, _ValueT, _ValueT>) {
9393
minmax_result<_ValueT> __result = {__r[0], __r[0]};
9494
for (auto __e : __r) {
9595
if (__e < __result.min)

0 commit comments

Comments
 (0)