DictionaryMap changes.

Add new flag to change the default size to make prod index boot faster. Remove option to select OffHeapDictionaryHashMap.
This commit is contained in:
Viktor Lofgren 2023-03-27 17:28:39 +02:00
parent 17ca4f9eea
commit 30584887f9
2 changed files with 3 additions and 7 deletions

View File

@ -4,12 +4,7 @@ public interface DictionaryMap {
int NO_VALUE = Integer.MIN_VALUE; int NO_VALUE = Integer.MIN_VALUE;
static DictionaryMap create() { static DictionaryMap create() {
if (!Boolean.getBoolean("large-ram")) { return new OnHeapDictionaryMap();
return new OnHeapDictionaryMap();
}
else {
return new OffHeapDictionaryHashMap(1L << 31);
}
} }
int size(); int size();

View File

@ -3,7 +3,8 @@ package nu.marginalia.dict;
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
public class OnHeapDictionaryMap implements DictionaryMap { public class OnHeapDictionaryMap implements DictionaryMap {
private final Long2IntOpenHashMap entries = new Long2IntOpenHashMap(100_000, 0.75f); private static final int DEFAULT_SIZE = Integer.getInteger("lexiconSizeHint", 100_000);
private final Long2IntOpenHashMap entries = new Long2IntOpenHashMap(DEFAULT_SIZE, 0.75f);
@Override @Override
public int size() { public int size() {