Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

亿级数据中判断数据是否不存在 是否直接用位图的方式好一些 #166

Open
jlhuang9 opened this issue Aug 5, 2019 · 0 comments

Comments

@jlhuang9
Copy link

jlhuang9 commented Aug 5, 2019

布隆过滤器说白了就是位图。
位图默认理解为一个长数组。

布隆过滤器我理解优势是在于string类型hashcode时好一些。
这种查找int类型没必要走二遍hashcode
直接把它的int值赋值就可以了吧。
BitSet bitSet = new BitSet();
int a = 1000;
bitSet.set(a, true);
System.out.println(bitSet.get(1000) == true);
这个在ip过滤我认为这样也可以。
只是这样如果数据量大内存空间会占的大一些(大约16M int的峰值是2 32次方,我们要实现的话要正负两个BitSet这样)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant