This is an automated email from the ASF dual-hosted git repository.
apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/master by this push:
new c4accca ARROW-8537: [C++] Revert Optimizing BitmapReader
c4accca is described below
commit c4accca7a55559e1dc1a5340facf44a69008367a
Author: Yibo Cai <[email protected]>
AuthorDate: Wed Apr 22 14:04:51 2020 +0200
ARROW-8537: [C++] Revert Optimizing BitmapReader
Revert PR https://github.com/apache/arrow/pull/6986 as it introduces
big performance regression to BitmapAnd unaligned benchmark.
Closes #7007 from cyb70289/bitmap
Authored-by: Yibo Cai <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/src/arrow/util/bit_util.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/cpp/src/arrow/util/bit_util.h b/cpp/src/arrow/util/bit_util.h
index 5b6cbf7..68bc0b4 100644
--- a/cpp/src/arrow/util/bit_util.h
+++ b/cpp/src/arrow/util/bit_util.h
@@ -507,21 +507,21 @@ class BitmapReader {
: bitmap_(bitmap), position_(0), length_(length) {
current_byte_ = 0;
byte_offset_ = start_offset / 8;
- bit_offset_mask_ = 1 << (start_offset % 8);
+ bit_offset_ = start_offset % 8;
if (length > 0) {
current_byte_ = bitmap[byte_offset_];
}
}
- bool IsSet() const { return (current_byte_ & bit_offset_mask_) != 0; }
+ bool IsSet() const { return (current_byte_ & (1 << bit_offset_)) != 0; }
- bool IsNotSet() const { return (current_byte_ & bit_offset_mask_) == 0; }
+ bool IsNotSet() const { return (current_byte_ & (1 << bit_offset_)) == 0; }
void Next() {
- bit_offset_mask_ <<= 1;
+ ++bit_offset_;
++position_;
- if (ARROW_PREDICT_FALSE(bit_offset_mask_ == 0)) {
- bit_offset_mask_ = 1;
+ if (ARROW_PREDICT_FALSE(bit_offset_ == 8)) {
+ bit_offset_ = 0;
++byte_offset_;
if (ARROW_PREDICT_TRUE(position_ < length_)) {
current_byte_ = bitmap_[byte_offset_];
@@ -537,8 +537,8 @@ class BitmapReader {
int64_t length_;
uint8_t current_byte_;
- uint8_t bit_offset_mask_;
int64_t byte_offset_;
+ int64_t bit_offset_;
};
class BitmapWriter {