Skip to content

Commit

Permalink
Don't create new ScoreTracker.NoOpTracker each time
Browse files Browse the repository at this point in the history
  • Loading branch information
dlg99 authored and jbellis committed Jan 3, 2024
1 parent 1405bc3 commit 01e1490
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ SearchResult searchInternal(NodeSimilarity.ScoreFunction scoreFunction,
}

prepareScratchState(view.size());
var scoreTracker = threshold > 0 ? new ScoreTracker.NormalDistributionTracker(threshold) : new ScoreTracker.NoOpTracker();
var scoreTracker = threshold > 0 ? new ScoreTracker.NormalDistributionTracker(threshold) : ScoreTracker.NO_OP;
if (ep < 0) {
return new SearchResult(new SearchResult.NodeScore[0], visited, 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
import org.apache.commons.math3.stat.StatUtils;

interface ScoreTracker {

ScoreTracker NO_OP = new NoOpTracker();

void track(float score);

boolean shouldStop(int numVisited);
Expand Down

0 comments on commit 01e1490

Please sign in to comment.