mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-09 04:17:51 +00:00
hint to the bounds checker for bitmapRepair
You might wonder why `i <= bitmapN-4`. Answer: The compiler isn't smart enough for the stride analysis to figure out that `i <= bitmapN` actually guarantees that. If you set the limit to something not a multiple of stride, though, it can't figure out *anything* about things. But for some reason, `i < bitmapN-3` fails badly (it actually adds bounds checks not present with `i < bitmapN`), but `i <= bitmapN - 4` works. This reduces runtime of bitmapRepair by about 14%.
This commit is contained in:
parent
8475b97d87
commit
cd81a9a33f
1 changed files with 2 additions and 2 deletions
|
|
@ -2255,8 +2255,8 @@ func (c *Container) bitmapRepair() {
|
|||
// Manually unroll loop to make it a little faster.
|
||||
// TODO(rartoul): Can probably make this a few x faster using
|
||||
// SIMD instructions.
|
||||
bitmap := c.bitmap()
|
||||
for i := 0; i < bitmapN; i += 4 {
|
||||
bitmap := c.bitmap()[:bitmapN]
|
||||
for i := 0; i <= bitmapN-4; i += 4 {
|
||||
n += int32(popcount(bitmap[i]))
|
||||
n += int32(popcount(bitmap[i+1]))
|
||||
n += int32(popcount(bitmap[i+2]))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue