Skip to content

Commit

Permalink
[improve](percentile_approx) use pdqsort to improve percentile_approx…
Browse files Browse the repository at this point in the history
… function performance
  • Loading branch information
zhangstar333 committed Sep 5, 2024
1 parent 5ea6e4b commit d87db38
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion be/src/util/tdigest.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

#pragma once

#include <pdqsort.h>

#include <algorithm>
#include <cfloat>
#include <cmath>
Expand Down Expand Up @@ -647,7 +649,7 @@ class TDigest {
// when complete, _unprocessed will be empty and _processed will have at most _max_processed centroids
void process() {
CentroidComparator cc;
RadixSort<TDigestRadixSortTraits>::executeLSD(_unprocessed.data(), _unprocessed.size());
pdqsort(_unprocessed.begin(), _unprocessed.end(), cc);
auto count = _unprocessed.size();
_unprocessed.insert(_unprocessed.end(), _processed.cbegin(), _processed.cend());
std::inplace_merge(_unprocessed.begin(), _unprocessed.begin() + count, _unprocessed.end(),
Expand Down

0 comments on commit d87db38

Please sign in to comment.