CompetitiveImpactAccumulator should protect its costly invariant checks behind an `assert`.

This commit is contained in:
Adrien Grand 2020-01-20 11:16:09 +01:00
parent 351b30489c
commit bddb06b650
1 changed files with 3 additions and 3 deletions

View File

@ -63,7 +63,7 @@ public final class CompetitiveImpactAccumulator {
public void clear() { public void clear() {
Arrays.fill(maxFreqs, 0); Arrays.fill(maxFreqs, 0);
otherFreqNormPairs.clear(); otherFreqNormPairs.clear();
assertConsistent(); assert assertConsistent();
} }
/** Accumulate a (freq,norm) pair, updating this structure if there is no /** Accumulate a (freq,norm) pair, updating this structure if there is no
@ -75,7 +75,7 @@ public final class CompetitiveImpactAccumulator {
} else { } else {
add(new Impact(freq, norm), otherFreqNormPairs); add(new Impact(freq, norm), otherFreqNormPairs);
} }
assertConsistent(); assert assertConsistent();
} }
/** Merge {@code acc} into this. */ /** Merge {@code acc} into this. */
@ -90,7 +90,7 @@ public final class CompetitiveImpactAccumulator {
add(entry, otherFreqNormPairs); add(entry, otherFreqNormPairs);
} }
assertConsistent(); assert assertConsistent();
} }
/** Get the set of competitive freq and norm pairs, ordered by increasing freq and norm. */ /** Get the set of competitive freq and norm pairs, ordered by increasing freq and norm. */