This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new eebedbc879b [optimize](cooldown)Reduce unnecessary sort operations for
vector (#27147)
eebedbc879b is described below
commit eebedbc879b02d5c8fcc388c1bfd89f0bcb08bfa
Author: xy <[email protected]>
AuthorDate: Fri Dec 15 00:13:56 2023 +0800
[optimize](cooldown)Reduce unnecessary sort operations for vector (#27147)
Co-authored-by: xingying01 <[email protected]>
---
be/src/olap/olap_server.cpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/be/src/olap/olap_server.cpp b/be/src/olap/olap_server.cpp
index e3c82f84eb4..f7caa7d8d02 100644
--- a/be/src/olap/olap_server.cpp
+++ b/be/src/olap/olap_server.cpp
@@ -1135,9 +1135,11 @@ void
StorageEngine::_cold_data_compaction_producer_callback() {
continue;
}
tablet_to_compact.emplace_back(t, score);
- std::sort(tablet_to_compact.begin(), tablet_to_compact.end(),
- [](auto& a, auto& b) { return a.second > b.second;
});
- if (tablet_to_compact.size() > n) tablet_to_compact.pop_back();
+ if (tablet_to_compact.size() > n) {
+ std::sort(tablet_to_compact.begin(),
tablet_to_compact.end(),
+ [](auto& a, auto& b) { return a.second >
b.second; });
+ tablet_to_compact.pop_back();
+ }
continue;
}
// else, need to follow
@@ -1151,9 +1153,12 @@ void
StorageEngine::_cold_data_compaction_producer_callback() {
// TODO(plat1ko): some avoidance strategy if failed to follow
auto score = t->calc_cold_data_compaction_score();
tablet_to_follow.emplace_back(t, score);
- std::sort(tablet_to_follow.begin(), tablet_to_follow.end(),
- [](auto& a, auto& b) { return a.second > b.second; });
- if (tablet_to_follow.size() > n) tablet_to_follow.pop_back();
+
+ if (tablet_to_follow.size() > n) {
+ std::sort(tablet_to_follow.begin(), tablet_to_follow.end(),
+ [](auto& a, auto& b) { return a.second > b.second;
});
+ tablet_to_follow.pop_back();
+ }
}
for (auto& [tablet, score] : tablet_to_compact) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]