BitBloomFilter does not use top 3 bits
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox114 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
(Whiteboard: [sp3])
Attachments
(2 files)
static const size_t kArraySize = (1 << (KeySize - 3));
static const uint32_t kKeyMask = (1 << (KeySize - 3)) - 1;
static const uint32_t kKeyShift = 16;
...
static uint32_t hash1(uint32_t aHash) { return aHash & kKeyMask; }
...
void setSlot(uint32_t aHash) {
uint32_t index = aHash / 8;
uint8_t shift = aHash % 8;
uint8_t bit = 1 << shift;
mCounters[index] |= bit;
...
uint8_t mCounters[kArraySize];
KeySize - 3
in kArraySize
is because single entry is uint8_t
,
kKeyMask
shouldn't use KeySize - 3
but just KeySize
, because the result is used to point single bit, and the - 3
part is already performed by aHash / 8
and aHash % 8
in setSlot
.
Assignee | ||
Comment 1•2 years ago
|
||
Assignee | ||
Comment 2•2 years ago
|
||
Depends on D175722
Comment 3•2 years ago
|
||
The point of a bloom filter is not to be correct, as false positive are acceptable.
Thus is technically not invalid to ignore some of the bits.
Is there any other reasoning behind the "part 1" ?
Assignee | ||
Comment 4•2 years ago
|
||
(In reply to Nicolas B. Pierron [:nbp] from comment #3)
The point of a bloom filter is not to be correct, as false positive are acceptable.
Thus is technically not invalid to ignore some of the bits.Is there any other reasoning behind the "part 1" ?
the code was using 2 ** (KeySize - 3)
bits, instead of 2 ** KeySize
bits, which means the only 1/8 of the array was used.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 6•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/932f5df42bd2
https://hg.mozilla.org/mozilla-central/rev/fd4414470dad
Description
•