You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "xuliang0317 (via GitHub)" <gi...@apache.org> on 2026/05/30 15:43:39 UTC

[PR] Xuliang0317 patch 1 [hbase]

xuliang0317 opened a new pull request, #8287:
URL: https://github.com/apache/hbase/pull/8287

   Optimize Bloom Filter bit operations by replacing array lookup with bitwise shift
   
   While this is functional, it introduces unnecessary overhead in the read path, which is highly performance-sensitive:
   
   Array Bounds Checking: The JVM must perform bounds checking for every array access to prevent ArrayIndexOutOfBoundsException, which adds minor but cumulative overhead.
   Memory Access: Even though bitvals is likely cached in L1/L2 CPU cache, it still requires a memory load instruction.
   Division/Modulo Overhead: In BloomFilterChunk#set(long pos), the code uses / 8 and % 8 which compiles to relatively expensive division instructions.
   Solution
   This PR optimizes the Bloom Filter bit operations by replacing the array lookup with direct bitwise shifts and optimizing the division/modulo operations:
   
   Direct Bitwise Shift: Replaced BloomFilterUtil.bitvals[bitPos] with (1 << bitPos).
   This eliminates array bounds checks completely.
   The JIT compiler can optimize 1 << bitPos into a single, extremely fast CPU instruction (SHL), executing entirely within CPU registers with zero memory access latency.
   Remove Unused Array: Removed the BloomFilterUtil.bitvals array completely to clean up the code.
   Division to Shift Optimization: In BloomFilterChunk#set(long pos), replaced pos / 8 and pos % 8 with pos >> 3 and pos & 7. Since pos is always non-negative in this context, this is a safe and much faster alternative to division instructions.
   Proposed Changes(去掉了不必要的数字,改成了位运算)


-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Xuliang0317 patch 1 [hbase]

Posted by "xuliang0317 (via GitHub)" <gi...@apache.org>.
xuliang0317 commented on PR #8287:
URL: https://github.com/apache/hbase/pull/8287#issuecomment-4583341896

   @Apache9 Could you review this PR when you get a chance?


-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Xuliang0317 patch 1 [hbase]

Posted by "xuliang0317 (via GitHub)" <gi...@apache.org>.
xuliang0317 commented on PR #8287:
URL: https://github.com/apache/hbase/pull/8287#issuecomment-4609748812

   @apurtell Could you please take a look at this PR when you have a moment? I'd appreciate any feedback or suggestions you might have. Thanks!


-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] HBASE-30205 Optimize Bloom Filter bit operations by replacing array lookup with bitwise shift [hbase]

Posted by "VladRodionov (via GitHub)" <gi...@apache.org>.
VladRodionov commented on PR #8287:
URL: https://github.com/apache/hbase/pull/8287#issuecomment-4721845731

   @xuliang0317 Do you observe any measurable performance improvements?


-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org