Skip to content

Commit

Permalink
Remove Parallel.For, saving.. 80ms out of the 90 it was taking?
Browse files Browse the repository at this point in the history
Premature optimization is the root of blah, blah, blah :D
  • Loading branch information
eduherminio committed Dec 8, 2023
1 parent f9d0ce2 commit 4ee222c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AoC_2023/Day_08.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public ulong Solve_2_Original()
var instruction = _input.Instructions[(int)(counter++ % (ulong)_input.Instructions.Length)];
finish = repetitionPeriodAfterEnd.All(p => p != default);

Parallel.For(0, currentNodeArray.Length, (i) =>
for (int i = 0; i < currentNodeArray.Length; ++i)
{
currentNodeArray[i] = instruction switch
{
Expand All @@ -105,7 +105,7 @@ public ulong Solve_2_Original()
repetitionPeriodAfterEnd[i] = counter - repetitionPeriodAfterEnd[i];
finish = false;
}
});
}
}

return SheepTools.Maths.LeastCommonMultiple(repetitionPeriodAfterEnd);
Expand Down

0 comments on commit 4ee222c

Please sign in to comment.