Author: j16sdiz
Date: 2008-07-10 11:54:35 +0000 (Thu, 10 Jul 2008)
New Revision: 21021
Modified:
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
branches/saltedhashstore/freenet/src/freenet/support/BloomFilter.java
Log:
fix optimial K calcuation
Modified:
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
===================================================================
---
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
2008-07-10 11:54:09 UTC (rev 21020)
+++
branches/saltedhashstore/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
2008-07-10 11:54:35 UTC (rev 21021)
@@ -53,7 +53,7 @@
private static final byte FLAG_DIRTY = 0x1;
private static final byte FLAG_REBUILD_BLOOM = 0x2;
- private static final int BLOOM_FILTER_SIZE = 0x8000000; // bits
+ private static final int BLOOM_FILTER_SIZE = 0x10000000; // 128Mib =
16MiB
private static final boolean updateBloom = true;
private static final boolean checkBloom = true;
private int bloomFilterK;
Modified: branches/saltedhashstore/freenet/src/freenet/support/BloomFilter.java
===================================================================
--- branches/saltedhashstore/freenet/src/freenet/support/BloomFilter.java
2008-07-10 11:54:09 UTC (rev 21020)
+++ branches/saltedhashstore/freenet/src/freenet/support/BloomFilter.java
2008-07-10 11:54:35 UTC (rev 21021)
@@ -191,7 +191,7 @@
* @return optimal K
*/
public static int optimialK(int filterLength, long maxKey) {
- long k = Math.round(Math.log(2) * maxKey / filterLength);
+ long k = Math.round(Math.log(2) * filterLength / maxKey);
if (k < 1)
k = 1;