Skip to content

Commit

Permalink
BestFirstSearch: minor optimization with HashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed May 4, 2024
1 parent 3abfc61 commit 675de1d
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ private class BestFirstSearch private (
actualSplit.foreach { split =>
val nextState = curr.next(split, allAltAreNL)
val updateBest = !keepSlowStates && depth == 0 && split.isNL &&
!best.contains(curr.depth)
if (updateBest) best.update(curr.depth, nextState)
best.getOrElseUpdate(curr.depth, nextState).eq(nextState)
style.runner.event(Enqueue(split))
split.optimalAt match {
case Some(OptimalToken(token, killOnFail))
Expand Down

0 comments on commit 675de1d

Please sign in to comment.