Reduce memory churn in KeywordCounter

This commit is contained in:
Viktor Lofgren 2023-01-30 09:42:27 +01:00
parent 8349435ef4
commit 5558af148e

View File

@ -43,8 +43,8 @@ public class KeywordCounter {
counts.mergeInt(rep.stemmed, 1, Integer::sum);
var instanceSet = instances.computeIfAbsent(rep.stemmed, k -> new HashSet<>(500));
if (instanceSet.size() < 250) {
var instanceSet = instances.computeIfAbsent(rep.stemmed, k -> new HashSet<>(16));
if (instanceSet.size() < 4) {
instanceSet.add(rep);
}
}