-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Performance](opt) opt the order by performance in permutation #38985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |||||||||
| #pragma once | ||||||||||
|
|
||||||||||
| #include <glog/logging.h> | ||||||||||
| #include <pdqsort.h> | ||||||||||
| #include <stdint.h> | ||||||||||
| #include <string.h> | ||||||||||
| #include <sys/types.h> | ||||||||||
|
|
@@ -269,14 +270,22 @@ class ColumnDecimal final : public COWHelper<IColumn, ColumnDecimal<T>> { | |||||||||
| for (U i = 0; i < s; ++i) res[i] = i; | ||||||||||
|
|
||||||||||
| auto sort_end = res.end(); | ||||||||||
| if (limit && limit < s) sort_end = res.begin() + limit; | ||||||||||
|
|
||||||||||
| if (reverse) | ||||||||||
| std::partial_sort(res.begin(), sort_end, res.end(), | ||||||||||
| [this](size_t a, size_t b) { return data[a] > data[b]; }); | ||||||||||
| else | ||||||||||
| std::partial_sort(res.begin(), sort_end, res.end(), | ||||||||||
| [this](size_t a, size_t b) { return data[a] < data[b]; }); | ||||||||||
| if (limit && limit < s / 8.0) { | ||||||||||
| sort_end = res.begin() + limit; | ||||||||||
| if (reverse) | ||||||||||
| std::partial_sort(res.begin(), sort_end, res.end(), | ||||||||||
| [this](size_t a, size_t b) { return data[a] > data[b]; }); | ||||||||||
| else | ||||||||||
| std::partial_sort(res.begin(), sort_end, res.end(), | ||||||||||
| [this](size_t a, size_t b) { return data[a] < data[b]; }); | ||||||||||
| } else { | ||||||||||
| if (reverse) | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: statement should be inside braces [readability-braces-around-statements]
Suggested change
be/src/vec/columns/column_decimal.h:283: - else
+ } else
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: statement should be inside braces [readability-braces-around-statements]
Suggested change
be/src/vec/columns/column_decimal.h:284: - else
+ } else |
||||||||||
| pdqsort(res.begin(), res.end(), | ||||||||||
| [this](size_t a, size_t b) { return data[a] > data[b]; }); | ||||||||||
| else | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: statement should be inside braces [readability-braces-around-statements]
Suggested change
be/src/vec/columns/column_decimal.h:285: - [this](size_t a, size_t b) { return data[a] < data[b]; });
+ [this](size_t a, size_t b) { return data[a] < data[b]; });
+ }
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: statement should be inside braces [readability-braces-around-statements]
Suggested change
be/src/vec/columns/column_decimal.h:286: - [this](size_t a, size_t b) { return data[a] < data[b]; });
+ [this](size_t a, size_t b) { return data[a] < data[b]; });
+ } |
||||||||||
| pdqsort(res.begin(), res.end(), | ||||||||||
| [this](size_t a, size_t b) { return data[a] < data[b]; }); | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| void ALWAYS_INLINE decimalv2_do_crc(size_t i, uint32_t& hash) const { | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -457,9 +457,8 @@ void ColumnStr<T>::get_permutation(bool reverse, size_t limit, int /*nan_directi | |||||||
| res[i] = i; | ||||||||
| } | ||||||||
|
|
||||||||
| if (limit >= s) { | ||||||||
| limit = 0; | ||||||||
| } | ||||||||
| // std::partial_sort need limit << s can get performance benefit | ||||||||
| if (limit > (s / 8.0)) limit = 0; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: statement should be inside braces [readability-braces-around-statements]
Suggested change
|
||||||||
|
|
||||||||
| if (limit) { | ||||||||
| if (reverse) { | ||||||||
|
|
@@ -469,9 +468,9 @@ void ColumnStr<T>::get_permutation(bool reverse, size_t limit, int /*nan_directi | |||||||
| } | ||||||||
| } else { | ||||||||
| if (reverse) { | ||||||||
| std::sort(res.begin(), res.end(), less<false>(*this)); | ||||||||
| pdqsort(res.begin(), res.end(), less<false>(*this)); | ||||||||
| } else { | ||||||||
| std::sort(res.begin(), res.end(), less<true>(*this)); | ||||||||
| pdqsort(res.begin(), res.end(), less<true>(*this)); | ||||||||
| } | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -236,7 +236,8 @@ void ColumnVector<T>::get_permutation(bool reverse, size_t limit, int nan_direct | |||||||
|
|
||||||||
| if (s == 0) return; | ||||||||
|
|
||||||||
| if (limit >= s) limit = 0; | ||||||||
| // std::partial_sort need limit << s can get performance benefit | ||||||||
| if (limit > (s / 8.0)) limit = 0; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: statement should be inside braces [readability-braces-around-statements]
Suggested change
|
||||||||
|
|
||||||||
| if (limit) { | ||||||||
| for (size_t i = 0; i < s; ++i) res[i] = i; | ||||||||
|
|
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: 'glog/logging.h' file not found [clang-diagnostic-error]