Skip to content
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

Bit: Minor refactor BitOp #2108

Merged
merged 4 commits into from
Feb 21, 2024
Merged

Bit: Minor refactor BitOp #2108

merged 4 commits into from
Feb 21, 2024

Conversation

mapleFU
Copy link
Member

@mapleFU mapleFU commented Feb 21, 2024

BitOp uses some c code style: It declare variables when first used, and don't have any comment.

This patch simplify the code and add some comments. It also uses rocksdb::PinnableSlice rather than std::string for performance.

@@ -491,46 +502,29 @@ rocksdb::Status Bitmap::BitOp(BitOpFlags op_flag, const std::string &op_name, co
lp[i] = reinterpret_cast<const uint64_t *>(fragments[i].data());
}
memcpy(frag_res.get(), fragments[0].data(), frag_minlen);

if (op_flag == kBitOpAnd) {
auto apply_fast_path_op = [&](auto op) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe auto vectorize can help avoid this code, however we might not enable it

@mapleFU mapleFU marked this pull request as ready for review February 21, 2024 11:15
Copy link

sonarcloud bot commented Feb 21, 2024

@git-hulk git-hulk merged commit 5fb6079 into apache:unstable Feb 21, 2024
30 checks passed
@mapleFU mapleFU deleted the refactor-bit-op branch February 21, 2024 16:18
JoverZhang pushed a commit to JoverZhang/kvrocks that referenced this pull request Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants