TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to write a Bloom filter in C++

130 pointsby schmatzabout 9 years ago

7 comments

nlyabout 9 years ago
I feel the use of vector&lt;bool&gt; is an iffy choice.<p>The Bitcoin codebase has a simple Bloom filter implementation you can take a look at that has been in use for some time<p><a href="https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bitcoin&#x2F;blob&#x2F;master&#x2F;src&#x2F;bloom.h" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bitcoin&#x2F;blob&#x2F;master&#x2F;src&#x2F;bloom.h</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bitcoin&#x2F;blob&#x2F;master&#x2F;src&#x2F;bloom.cpp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;bitcoin&#x2F;bitcoin&#x2F;blob&#x2F;master&#x2F;src&#x2F;bloom.cpp</a>
评论 #11480107 未加载
评论 #11478447 未加载
nate_martinabout 9 years ago
This example works well for raw data but not for complex types. You could make the filter a template, taking the key and a &quot;hasher&quot; function as template args.
评论 #11476753 未加载
评论 #11476570 未加载
sokoloffabout 9 years ago
Learned something today. Thanks for the article.<p>Minor nit: it will save readers time if you call out that &quot;p is the false positive error rate&quot;. (You reference the error rate, but don&#x27;t attach a variable name to it.) I had to go to an external reference to figure that out, which meant I learned something else of course.
评论 #11480656 未加载
barsonmeabout 9 years ago
Or in C[0] or in Go[1]...<p>[0] - <a href="https:&#x2F;&#x2F;github.com&#x2F;EricLagergren&#x2F;bloom" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;EricLagergren&#x2F;bloom</a> [1] - <a href="https:&#x2F;&#x2F;github.com&#x2F;EricLagergren&#x2F;bloom-c" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;EricLagergren&#x2F;bloom-c</a>
j_sabout 9 years ago
Is there a standard implementation &quot;everybody uses&quot;? Bloomd seems popular as a bloom filter server.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;armon&#x2F;bloomd" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;armon&#x2F;bloomd</a>
m00dyabout 9 years ago
I have also experiments about Bloom Filter in python <a href="https:&#x2F;&#x2F;github.com&#x2F;erenyagdiran&#x2F;BloomFilter" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;erenyagdiran&#x2F;BloomFilter</a>
nvckenabout 9 years ago
How is your laptop spec ? please
评论 #11477088 未加载