替代Java的比特集与数组一样的性能? [英] Alternative to Java Bitset with array like performance?

查看:166
本文介绍了替代Java的比特集与数组一样的性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要寻找替代Java的比特集实现。我实现了高性能算法似乎是用比特集对象是杀害其性能。任何想法?

I am looking for an alternative to Java Bitset implementation. I am implementing a high performance algorithm and seems like using a Bitset object is killing its performance. Any ideas?

推荐答案

这里比较了布尔[] 位集合并得出结论:

Someone here has compared boolean[] to BitSet and concluded with:

位集合是更多的内存效率比布尔[] 除了非常
  小尺寸。每个布尔数组中取一个字节。号码
  从 runtime.freeMemory()都有点糊涂了位集合,但较少。

BitSet is more memory efficient than boolean[] except for very small sizes. Each boolean in the array takes a byte. The numbers from runtime.freeMemory() are a bit muddled for BitSet, but less.

布尔[] 更高效的CPU除了非常大的规模,其中
  他们是约什。例如,尺寸为百万布尔[]
  快四倍(例如6ms的VS 27ms),十和一亿
  他们是约什。

boolean[] is more CPU efficient except for very large sizes, where they are about even. E.g., for size 1 million boolean[] is about four times faster (e.g. 6ms vs 27ms), for ten and a hundred million they are about even.

如果您谷歌,你可以找到一些替代的实现,以及像 JavaEWAH ,以的Apache蜂巢,的阿帕奇星火的Eclipse JGit 。它声称:

If you Google, you can find some alternative implementations as well, like JavaEWAH, used by Apache Hive, Apache Spark and Eclipse JGit. It claims:

字对齐COM pression的目标是不是达到最佳
  COM pression,而是为了提高查询处理时间。因此,我们
  试图保存CPU周期,也许在存储的费用。然而,
  我们实施EWAH方案比永远更高效的存储明智
  一个uncom pressed位图作为位集合类实现)。不比
  一些替代品,javaewah不依赖于专利的方案。

The goal of word-aligned compression is not to achieve the best compression, but rather to improve query processing time. Hence, we try to save CPU cycles, maybe at the expense of storage. However, the EWAH scheme we implemented is always more efficient storage-wise than an uncompressed bitmap as implemented in the BitSet class). Unlike some alternatives, javaewah does not rely on a patented scheme.

这篇关于替代Java的比特集与数组一样的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆