Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
bbloom
Commits
627bb99e
Unverified
Commit
627bb99e
authored
Aug 23, 2019
by
Steven Allen
Committed by
GitHub
Aug 23, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6 from ipfs/fix/odd-ends
fix clear performance
parents
b3466c29
84e8303a
Pipeline
#87
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
bbloom.go
bbloom.go
+4
-2
No files found.
bbloom.go
View file @
627bb99e
...
...
@@ -162,6 +162,7 @@ func (bl *Bloom) Has(entry []byte) bool {
res
=
res
&&
bl
.
isSet
((
h
+
i
*
l
)
&
bl
.
size
)
// Branching here (early escape) is not worth it
// This is my conclusion from benchmarks
// (prevents loop unrolling)
// if !res {
// return false
// }
...
...
@@ -209,8 +210,9 @@ func (bl *Bloom) AddIfNotHasTS(entry []byte) (added bool) {
// Clear
// resets the Bloom filter
func
(
bl
*
Bloom
)
Clear
()
{
for
i
,
_
:=
range
(
*
bl
)
.
bitset
{
bl
.
bitset
[
i
]
=
0
bs
:=
bl
.
bitset
// important performance optimization.
for
i
:=
range
bs
{
bs
[
i
]
=
0
}
bl
.
content
=
0
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment