Merge branch 'master' of github.com:OpenHFT/Chronicle-Map

Conflicts:
	src/main/java/net/openhft/chronicle/map/AbstractChronicleMapBuilder.java
This commit is contained in:
leventov
2014-11-10 18:15:58 +03:00
4 changed files with 57 additions and 54 deletions
@@ -372,10 +372,8 @@ public abstract class AbstractChronicleMapBuilder<K, V,
if (segments == 1)
return entries;
double poorDistEntriesScale = Math.log(segments) * entries;
if (segments <= 8)
return Math.min(entries * segments,
(long) (entries + poorDistEntriesScale * 0.11 + segments * 8)); // 11% was min for tests
return (long) (entries + poorDistEntriesScale * 0.11 + 80); // 11% was min for tests
return Math.min(entries * segments,
(long) (entries + poorDistEntriesScale * 0.14 + 32)); // 12% was min for tests
}
@Override
@@ -390,24 +388,22 @@ public abstract class AbstractChronicleMapBuilder<K, V,
}
private int estimateSegments() {
for (int power = 1; power < 64; power *= 2) {
if (entries <= power * power * power)
return power;
}
long size = (entrySize + 32) * entries;
if (size < 10L * 1000 * 1000) // 10 MB
return 64;
if (size < 100L * 1000 * 1000) // 100 MB
return 128;
if (size < 400L * 1000 * 1000) // 400 MB
return 256;
if (size < 1L * 1000 * 1000 * 1000) // 1 GB
return (int) Math.min(Maths.nextPower2(entries / 32, 1), estimateSegementBasedOnSize());
}
private int estimateSegementBasedOnSize() {
// based on entries with multimap of 100 bytes.
long size = (long) (Math.log10(entrySize + 32) / 2 * entries);
if (size < 10 * 1000)
return 512;
if (size < 10L * 1000 * 1000 * 1000) // 10 GB
if (size < 100 * 1000)
return 1024;
if (size < 100L * 1000 * 1000 * 1000) // 100 GB
if (size < 1000 * 1000)
return 2048;
return 4096;
if (size < 10 * 1000 * 1000)
return 4096;
return 8192;
}
@Override
@@ -443,7 +439,7 @@ public abstract class AbstractChronicleMapBuilder<K, V,
int segmentHeaderSize() {
int segments = actualSegments();
// reduce false sharing unless we have a lot of segments.
return segments <= 8192 ? 64 : 16;
return segments <= 8192 ? 128 : 64;
}
MultiMapFactory multiMapFactory() {