[enhancement]optimize some bitmap function logic#17218
Closed
ucasfl wants to merge 2 commits intoapache:masterfrom
ucasfl:bitmap
Closed
[enhancement]optimize some bitmap function logic#17218ucasfl wants to merge 2 commits intoapache:masterfrom ucasfl:bitmap
ucasfl wants to merge 2 commits intoapache:masterfrom
ucasfl:bitmap
Conversation
Signed-off-by: flynn <fenglv15@mails.ucas.ac.cn>
ucasfl
commented
Feb 28, 2023
| */ | ||
| int64_t sub_range(const int64_t& range_start, const int64_t& range_end, | ||
| BitmapValue* ret_bitmap) { | ||
| int64_t sub_range(int64_t range_start, int64_t range_end, BitmapValue* ret_bitmap) { |
Contributor
Author
There was a problem hiding this comment.
It's prefer pass by value than pass by const reference for basic data type.
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
ucasfl
commented
Feb 28, 2023
Comment on lines
1712
to
1720
| auto it = _bitmap.begin(); | ||
| for (; it != _bitmap.end() && *it < range_start;) { | ||
| ++it; | ||
| } | ||
|
|
||
| int64_t count = 0; | ||
| for (auto it = _bitmap.begin(); it != _bitmap.end(); ++it) { | ||
| if (*it < range_start) { | ||
| continue; | ||
| } | ||
| if (*it < range_end) { | ||
| ret_bitmap->add(*it); | ||
| ++count; | ||
| } else { | ||
| break; | ||
| } | ||
| for (; it != _bitmap.end() && *it < range_end; ++it) { | ||
| ret_bitmap->add(*it); | ||
| ++count; |
Contributor
Author
There was a problem hiding this comment.
Reducing branch statement for better vectorization.
cambyzju
reviewed
Feb 28, 2023
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Contributor
|
clang-tidy review says "All clean, LGTM! 👍" |
Contributor
|
Please describe your change |
Contributor
Author
done. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Issue Number: close #xxx
Optimize logic of bitmap function
bitmap_subset_in_rangeandbitmap_subset_limit: pass arguments by value for basic type, and reduce branch stantement for better vectorization.Problem summary
Describe your changes.
Checklist(Required)
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...