lszskye commented on code in PR #552:
URL: https://github.com/apache/paimon-cpp/pull/552#discussion_r4549053024
##########
src/paimon/common/utils/roaring_bitmap64.cpp:
##########
@@ -345,9 +345,9 @@ std::string RoaringBitmap64::ToString() const {
}
RoaringBitmap64 RoaringBitmap64::And(const RoaringBitmap64& lhs, const
RoaringBitmap64& rhs) {
- RoaringBitmap64 res;
- GetRoaringBitmap(res.roaring_bitmap_) =
- (GetRoaringBitmap(lhs.roaring_bitmap_) &
GetRoaringBitmap(rhs.roaring_bitmap_));
+ const bool copy_lhs = lhs.GetSizeInBytes() <= rhs.GetSizeInBytes();
+ RoaringBitmap64 res(copy_lhs ? lhs : rhs);
+ res &= (copy_lhs ? rhs : lhs);
Review Comment:
Could we drop this optimization? GetSizeInBytes() traverses the containers
of both inputs just to choose which one to copy. Using Cardinality() would
still require traversing the containers in the current implementation. Element
count also does not reliably indicate copy cost, since compression and element
distribution affect the storage size.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]