Skip to content

Commit

Permalink
Reduce allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkschumacher committed May 13, 2024
1 parent 96d0476 commit fcbc3d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions solution_sequence_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func SequenceGeneratorChannel(

func sequenceGeneratorSync(pu SolutionPlanUnit, yield func(SolutionStops)) {
planUnit := pu.(*solutionPlanStopsUnitImpl)
solutionStops := planUnit.SolutionStops()
solutionStops := planUnit.solutionStops
if planUnit.ModelPlanStopsUnit().NumberOfStops() == 1 {
yield(solutionStops)
yield(planUnit.SolutionStops())
return
}
solution := planUnit.solution()
Expand Down Expand Up @@ -76,7 +76,8 @@ func sequenceGeneratorSync(pu SolutionPlanUnit, yield func(SolutionStops)) {
}

func recSequenceGenerator(
stops, sequence SolutionStops,
stops []solutionStopImpl,
sequence SolutionStops,
used []bool,
inDegree map[int]int,
dag DirectedAcyclicGraph,
Expand Down Expand Up @@ -104,7 +105,8 @@ func recSequenceGenerator(
if directSuccessor != -1 {
for _, stopIdx := range stopOrder {
if stops[stopIdx].Index() == directSuccessor {
stopOrder = []int{stopIdx}
stopOrder = stopOrder[:1]
stopOrder[0] = stopIdx
break
}
}
Expand Down

0 comments on commit fcbc3d3

Please sign in to comment.