Skip to content

Commit

Permalink
recalculate-score is parallel now
Browse files Browse the repository at this point in the history
  • Loading branch information
ForNeVeR committed Jul 9, 2023
1 parent 9544e2c commit 5c7a31c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Icfpc2023/Program.fs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
open System
open System.IO
open System.Text
open System.Threading
open System.Threading.Tasks

open Icfpc2023
Expand Down Expand Up @@ -207,9 +208,13 @@ let recalculateScoreCommand (problemId: int) =

let recalculateScoreAllCommand () =
let problems = Directory.GetFiles(problemsDir, "*.json")
for problem in problems do
let mutable finished = 0
Parallel.ForEach(problems, fun (problem: string) ->
let problemId = Path.GetFileNameWithoutExtension problem |> int
recalculateScoreCommand problemId
let res = Interlocked.Increment(&finished)
printfn $"Finished {res} / {problems.Length} problems"
) |> ignore

let convertIni problemFile =
let problem = JsonDefs.ReadProblemFromFile problemFile |> postProcessProblem
Expand Down

0 comments on commit 5c7a31c

Please sign in to comment.