mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Give more conservative head room for avoid Map's with an imperfect hash distribution filling up.
This commit is contained in:
@@ -385,8 +385,13 @@ public class ChronicleMapBuilder<K, V> implements Cloneable,
|
||||
if (actualEntriesPerSegment > 0)
|
||||
return actualEntriesPerSegment;
|
||||
int as = actualSegments();
|
||||
long actualEntries =
|
||||
as == 1 ? entries + 1 : // The extra 1 might not be needed.
|
||||
as <= 4 ? entries * 10L / 9 : // 10%, assumes you are trying to be tight.
|
||||
entries * 5L / 4; // 25%
|
||||
|
||||
// round up to the next multiple of 64.
|
||||
return (int) (Math.max(1, entries * 2L / as) + 63) & ~63;
|
||||
return (int) (Math.max(1, actualEntries / as) + 63) & ~63;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
package net.openhft.chronicle.map.serialization;
|
||||
|
||||
import net.openhft.chronicle.map.threadlocal.Provider;
|
||||
import net.openhft.chronicle.map.threadlocal.StatefulCopyable;
|
||||
import net.openhft.chronicle.map.threadlocal.ThreadLocalCopies;
|
||||
import net.openhft.lang.io.Bytes;
|
||||
import net.openhft.lang.io.DirectBytes;
|
||||
import net.openhft.lang.io.DirectStore;
|
||||
import net.openhft.lang.io.serialization.BytesMarshaller;
|
||||
import net.openhft.lang.io.serialization.JDKObjectSerializer;
|
||||
import net.openhft.chronicle.map.threadlocal.Provider;
|
||||
import net.openhft.chronicle.map.threadlocal.StatefulCopyable;
|
||||
import net.openhft.chronicle.map.threadlocal.ThreadLocalCopies;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
@@ -190,7 +190,7 @@ public abstract class CopyingMetaBytesInterop<E, W> implements MetaBytesInterop<
|
||||
forBytesWriter = new ForBytesWriter();
|
||||
}
|
||||
|
||||
private Bytes obtain(long maxSize) {
|
||||
Bytes obtain(long maxSize) {
|
||||
DirectBytes buf;
|
||||
if ((buf = buffer) != null) {
|
||||
if (maxSize <= buf.capacity()) {
|
||||
|
||||
Reference in New Issue
Block a user