Skip to content

Commit

Permalink
not working
Browse files Browse the repository at this point in the history
  • Loading branch information
safesparrow committed Nov 11, 2022
1 parent 7ffa15f commit 9048a96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tests/ParallelTypeCheckingTests/Code/GraphProcessing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ let combineResults
(deps: Node<'Item, 'State, 'Result>[])
(transitiveDeps: Node<'Item, 'State, 'Result>[])
(folder: 'State -> 'Result -> 'State)
(_foldingOrderer: 'Item -> int)
: 'State =
match deps with
| [||] -> emptyState
Expand All @@ -127,7 +128,7 @@ let combineResults
// Sort it by effectively file index.
// For some reason this is needed, otherwise gives 'missing namespace' and other errors when using the resulting state.
// Does this make sense? Should the results be foldable in any order?
|> Array.sortBy (fun d -> d.Info.Item)
|> Array.sortBy (fun node -> node.Info.Item)
|> Array.filter (fun dep -> included.Contains dep.Info.Item = false)
|> Array.distinctBy (fun dep -> dep.Info.Item)
|> Array.map (fun dep -> dep.Result |> orFail |> snd)
Expand All @@ -140,6 +141,7 @@ let processGraph<'Item, 'State, 'Result, 'FinalFileResult when 'Item: equality a
(graph: Graph<'Item>)
(doWork: 'Item -> 'State -> 'Result)
(folder: 'State -> 'Result -> 'FinalFileResult * 'State)
(foldingOrderer: 'Item -> int)
(emptyState: 'State)
(includeInFinalState: 'Item -> bool)
(parallelism: int)
Expand Down Expand Up @@ -208,7 +210,7 @@ let processGraph<'Item, 'State, 'Result, 'FinalFileResult when 'Item: equality a
let folder x y = folder x y |> snd
let deps = lookupMany node.Info.Deps
let transitiveDeps = lookupMany node.Info.TransitiveDeps
let inputState = combineResults emptyState deps transitiveDeps folder
let inputState = combineResults emptyState deps transitiveDeps folder foldingOrderer
node.InputState <- Some inputState
let singleRes = doWork node.Info.Item inputState.State

Expand Down
2 changes: 2 additions & 0 deletions tests/ParallelTypeCheckingTests/Code/ParallelTypeChecking.fs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ let CheckMultipleInputsInParallel
graph
processFile
folder
// When combining results, order them by index
(fun file -> file.Idx.Idx)
state
(fun it -> not <| it.Name.EndsWith(".fsix"))
10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module FakeGraphProcessing =

let processFileGraph<'Item when 'Item: comparison> (graph: Graph<'Item>) : FinalFileResult[] * State =
let parallelism = 4 // cpu count?
GraphProcessing.processGraph graph typeCheckFile folder "" (fun _ -> true) parallelism
GraphProcessing.processGraph graph typeCheckFile folder (fun _item -> _item.ToString().GetHashCode()) "" (fun _ -> true) parallelism

let deps: Graph<int> =
[|
Expand Down

0 comments on commit 9048a96

Please sign in to comment.