Skip to content

Commit 01c28a3

Browse files
committed
Cleanup
1 parent 136792b commit 01c28a3

9 files changed

Lines changed: 20 additions & 36 deletions

File tree

src/Compiler/Driver/ParseAndCheckInputs.fs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,12 @@ let ParseInputFilesInParallel (tcConfig: TcConfig, lexResourceManager, sourceFil
758758

759759
for fileName in sourceFiles do
760760
checkInputFile tcConfig fileName
761-
761+
762+
763+
// Order files to be parsed by size (descending). The idea is to process big files first,
764+
// so that near the end when only some nodes are still processing items, it's the smallest items,
765+
// which should reduce the period of time where only some nodes are busy.
766+
// This requires some empirical evidence.
762767
let sourceFiles =
763768
sourceFiles
764769
|> List.mapi (fun i f -> i, f)
@@ -775,6 +780,7 @@ let ParseInputFilesInParallel (tcConfig: TcConfig, lexResourceManager, sourceFil
775780
parseInputFileAux (tcConfig, lexResourceManager, fileName, (isLastCompiland, isExe), delayLogger, retryLocked)
776781

777782
idx, (input, directoryName))
783+
// Bring back index-based order
778784
|> List.sortBy fst
779785
|> List.map snd
780786
)

tests/ParallelTypeCheckingTests/Code/ASTVisit.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,6 +1310,7 @@ module TopModulesExtraction =
13101310
range) ->
13111311
let idents =
13121312
// TODO Fix this by making it similar to what happens in other places where we detect AutoOpen modules
1313+
// Currently it doesn't matter, since we don't look within modules.
13131314
if mightHaveAutoOpen synAttributeLists then
13141315
// Contents of a module that's potentially AutoOpen are available everywhere, so treat it as if it had no name ('root' module).
13151316
[| LongIdent.Empty |]

tests/ParallelTypeCheckingTests/Code/Graph.fs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ module Graph =
4242
graph.Values |> Seq.toArray |> Array.concat |> Array.except graph.Keys
4343

4444
addIfMissing missingNodes graph
45-
4645

4746
/// Create a transitive closure of the graph
4847
let transitiveOpt<'Node when 'Node: equality> (graph: Graph<'Node>) : Graph<'Node> =
@@ -107,8 +106,3 @@ module Graph =
107106
let json = JsonConvert.SerializeObject(graph, Formatting.Indented)
108107
printfn $"Serialising graph as JSON in {path}"
109108
File.WriteAllText(path, json)
110-
111-
module FileGraph =
112-
// open GiGraph.Dot
113-
let makeDotFile (_path : string) (_graph : Graph<File>) : unit =
114-
()

tests/ParallelTypeCheckingTests/Code/GraphProcessing.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ let combineResults
128128
// Sort it by effectively file index.
129129
// For some reason this is needed, otherwise gives 'missing namespace' and other errors when using the resulting state.
130130
// Does this make sense? Should the results be foldable in any order?
131+
// TODO Use _foldingOrderer
131132
|> Array.sortBy (fun node -> node.Info.Item)
132133
|> Array.filter (fun dep -> included.Contains dep.Info.Item = false)
133134
|> Array.distinctBy (fun dep -> dep.Info.Item)

tests/ParallelTypeCheckingTests/Code/ParallelTypeChecking.fs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -113,35 +113,19 @@ let CheckMultipleInputsInParallel
113113
else
114114
graph
115115

116-
let find (s : string) =
117-
let matches (f : File) = f.Name.Contains(s, StringComparison.InvariantCultureIgnoreCase)
118-
let files = graph.Files |> Array.filter (fun f -> matches f.File)
119-
let d =
120-
graph.Graph
121-
|> Seq.filter (fun (KeyValue(f, _deps)) -> matches f)
122-
|> Seq.map (fun (KeyValue(f, deps)) -> f, deps)
123-
|> dict
124-
125-
files
126-
|> Array.map (fun f -> f, d[f.File])
127-
128-
let _a = find "PostInferenceChecks.fsi"
129-
let _b = find "ConstraintSolver"
130-
131-
// graph.Graph |> Graph.print
132-
133-
let _graphDumpPath =
116+
graph.Graph |> Graph.print
117+
118+
let graphDumpPath =
134119
let graphDumpName =
135120
tcConfig.outputFile
136121
|> Option.map Path.GetFileName
137122
|> Option.defaultValue "project"
138123

139124
$"{graphDumpName}.deps.json"
140-
141125

142-
// graph.Graph
143-
// |> Graph.map (fun n -> n.Name)
144-
// |> Graph.serialiseToJson graphDumpPath
126+
graph.Graph
127+
|> Graph.map (fun n -> n.Name)
128+
|> Graph.serialiseToJson graphDumpPath
145129

146130
let _ = ctok // TODO Use
147131
let diagnosticsLogger = DiagnosticsThreadStatics.DiagnosticsLogger

tests/ParallelTypeCheckingTests/Code/Types.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ type File =
6161
}
6262

6363
member this.Name = this.AST.Name // TODO Use qualified name
64+
// TODO Remove
6465
member this.CodeSize = 0
6566
member this.QualifiedName = this.AST.QualifiedName
6667

tests/ParallelTypeCheckingTests/Tests/TestCompilationFromCmdlineArgs.fs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ let ``1. Test sequential type-checking`` (code: Codebase) =
9595
let config = codebaseToConfig code Method.Sequential
9696
TestCompilerFromArgs config
9797

98-
/// Before running these tests, you must prepare the codebase by running the script 'FCS.prepare.ps1'
98+
/// Before running this test, you must prepare the codebase by running the script 'FCS.prepare.ps1'
9999
[<TestCaseSource(nameof (codebases))>]
100-
// [<Explicit("Slow, only useful as a sanity check that the test codebase is sound and type-checks using the parallel-fs method")>]
100+
[<Explicit("Slow, only useful as a sanity check that the test codebase is sound and type-checks using the parallel-fs method")>]
101101
let ``2. Test parallelfs type-checking`` (code: Codebase) =
102102
let config = codebaseToConfig code Method.ParallelCheckingOfBackedImplFiles
103103
TestCompilerFromArgs config
104104

105-
/// Before running these tests, you must prepare the codebase by running the script 'FCS.prepare.ps1'
105+
/// Before running this test, you must prepare the codebase by running the script 'FCS.prepare.ps1'
106106
[<TestCaseSource(nameof (codebases))>]
107107
let ``3. Test graph-based type-checking`` (code: Codebase) =
108108
let config = codebaseToConfig code Method.Graph

tests/ParallelTypeCheckingTests/Tests/TestDependencyResolution.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ open A
5151

5252

5353
[<Test>]
54-
let ``Another failing FCS test`` () =
54+
let ``A top-level module with an attribute, belonging to a namespace, depends on another file that uses the same namespace`` () =
5555
let files =
5656
[|
5757
"A.fsi", """

tests/benchmarks/FCSBenchmarks/BenchmarkComparison/HistoricalBenchmark.fsproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@
6666
<HintPath>$(FSharpCoreDllPath)</HintPath>
6767
</Reference>
6868
</ItemGroup>
69-
<ItemGroup>
70-
<Content Include="runner.ipynb" />
71-
</ItemGroup>
7269

7370
<Target Name="FakeBuild" BeforeTargets="Build">
7471
<Message Text="Type=$(FcsReferenceType) FcsDllPath=$(FcsDllPath)" />

0 commit comments

Comments
 (0)