-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[Enhancement]generate new range faster #55627
Conversation
Signed-off-by: zombee0 <ewang2027@gmail.com>
be/src/storage/range.h
Outdated
start = start > i && filter->data()[i] == 1 ? i : start; | ||
end = end < i && filter->data()[i] == 1 ? i : end; | ||
int32_t tail_index = filter->size() - 1 - i; | ||
end = end < tail_index && filter->data()[tail_index] == 1 ? tail_index : end; |
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.
What is this function used for? I couldn't understand its meaning just by looking at the code. Is it for finding the upper and lower bounds? Why not just write two loops—one for finding the start and one for finding the end?
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.
Yes, it's used to find upper and lower bounds, i think less loop, less branch, we also use ?:
to reduce branch.
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.
? is also one branch?
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.
i think it can be optimized as cmov
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.
I checked assembly code
complier cann't generate branch-less code, and it's not critical part in cpu usage,
so just use simple way
Signed-off-by: zombee0 <ewang2027@gmail.com>
complier cann't generate branch-less code, and it's not critical part in cpu usage, so just use simple way Signed-off-by: zombee0 <ewang2027@gmail.com>
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[BE Incremental Coverage Report]✅ pass : 6 / 6 (100.00%) file detail
|
@Mergifyio backport branch-3.4 |
@Mergifyio backport branch-3.3 |
✅ Backports have been created
|
✅ Backports have been created
|
Signed-off-by: zombee0 <ewang2027@gmail.com> (cherry picked from commit 712fc09)
Signed-off-by: zombee0 <ewang2027@gmail.com> (cherry picked from commit 712fc09) # Conflicts: # be/src/storage/range.h
Why I'm doing:
I checked assembly code, complier can't generate branch-less code,
and it's not critical part in cpu usage, so just use simple way
What I'm doing:
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: