-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
[improvement](bitmap) Use shared_ptr in BitmapValue to avoid deep copying #19101
Conversation
run buildall |
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.
clang-tidy made some suggestions
be/src/util/bitmap_value.h
Outdated
BitmapValue& operator=(const BitmapValue& other) { | ||
_type = other._type; | ||
_sv = other._sv; | ||
_bitmap = other._bitmap; | ||
return *this; | ||
} |
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: use '= default' to define a trivial copy-assignment operator [modernize-use-equals-default]
BitmapValue& operator=(const BitmapValue& other) { | |
_type = other._type; | |
_sv = other._sv; | |
_bitmap = other._bitmap; | |
return *this; | |
} | |
BitmapValue& operator=(const BitmapValue& other) = default; |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
TeamCity pipeline, clickbench performance test result: |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
return; | ||
} | ||
|
||
if (_bitmap.use_count() > 1) { |
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.
感觉这里用use count 可能不太好,不如记录一个标记位,比如is_owner 这样的,然后再copy constructor 还有operator=的时候,都把is_owner 设置为false;prepare for write的时候,设置为true。
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 owner == true,就直接return了。 我觉得一个bool 的判断效率要比 shared ptr use count 高
run buildall |
clang-tidy review says "All clean, LGTM! 👍" |
TeamCity pipeline, clickbench performance test result: |
clang-tidy review says "All clean, LGTM! 👍" |
run buildall |
TeamCity pipeline, clickbench performance test result: |
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.
LGTM
PR approved by at least one committer and no changes requested. |
PR approved by anyone and no changes requested. |
…ying (apache#19101) Currently bitmapvalue type is copied between columns, it cost a lot of memory. Use a shared ptr in bitmap value to avoid copy data.
…ying (apache#19101) (apache#21271) Currently bitmapvalue type is copied between columns, it cost a lot of memory. Use a shared ptr in bitmap value to avoid copy data.
Proposed changes
Currently bitmapvalue type is copied between columns, it cost a lot of memory. Use a shared ptr in bitmap value to avoid copy data.
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...