bits-and-blooms / bloom

Go package implementing Bloom filters, used by Milvus and Beego.
BSD 2-Clause "Simplified" License
2.44k stars 232 forks source link

bloom: Remove the side effect of the `EstimateFalsePositiveRate` function #80

Closed SimFG closed 2 years ago

SimFG commented 2 years ago

Remove the side effect of the EstimateFalsePositiveRate function. Using the Copy function will has no effect on the current object.

SimFG commented 2 years ago

@lemire Help me review this pull request :>

lemire commented 2 years ago

It is not clear why this is needed. You can just do...

something := f.Copy()
something.EstimateFalsePositiveRate()

If we don't want to empty the filter, we can do something smarter.

lemire commented 2 years ago

You are right that this function is nasty. I suggest to break it totally and to provide something new instead:

https://github.com/bits-and-blooms/bloom/pull/83