From 119a2eb6781b2600d4715a5345b17d253434780d Mon Sep 17 00:00:00 2001 From: Viktor Hofer Date: Mon, 8 Jan 2024 10:21:58 +0100 Subject: [PATCH 1/5] Remove unnecessary DotNetBuildOffline switches (#16489) --- .../SelfContained_Trimming_Test.fsproj | 1 - .../StaticLinkedFSharpCore_Trimming_Test.fsproj | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj index cb02b7e0fd6..90842baa584 100644 --- a/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj +++ b/tests/AheadOfTime/Trimming/SelfContained_Trimming_Test/SelfContained_Trimming_Test.fsproj @@ -5,7 +5,6 @@ net8.0 preview true - true diff --git a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj index d36faf2c0df..7fd0dc7091c 100644 --- a/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj +++ b/tests/AheadOfTime/Trimming/StaticLinkedFSharpCore_Trimming_Test/StaticLinkedFSharpCore_Trimming_Test.fsproj @@ -5,7 +5,6 @@ net8.0 preview true - true false --standalone From 777da0a2b627c0465af2e15b8ca7a628188d78cc Mon Sep 17 00:00:00 2001 From: Petr Date: Mon, 8 Jan 2024 17:31:11 +0100 Subject: [PATCH 2/5] Fixing and simplifying background compiler benchmarks (#16501) * Fixing and simplifying background compiler benchmarks * up * Rename --- .../BackgroundCompilerBenchmarks.fs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs index 3b44c1d37bf..a6ce4b36487 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs @@ -152,10 +152,7 @@ type NoFileSystemCheckerBenchmark() = let mutable benchmark : ProjectWorkflowBuilder = Unchecked.defaultof<_> [] - member val UseGetSource = true with get,set - - [] - member val UseChangeNotifications = true with get,set + member val UseInMemoryDocuments = true with get,set [] member val EmptyCache = true with get,set @@ -165,8 +162,8 @@ type NoFileSystemCheckerBenchmark() = benchmark <- ProjectWorkflowBuilder( project, - useGetSource = this.UseGetSource, - useChangeNotifications = this.UseChangeNotifications).CreateBenchmarkBuilder() + useGetSource = this.UseInMemoryDocuments, + useChangeNotifications = this.UseInMemoryDocuments).CreateBenchmarkBuilder() [] member this.EditFirstFile_OnlyInternalChange() = @@ -178,15 +175,14 @@ type NoFileSystemCheckerBenchmark() = member this.ExampleWorkflow() = use _ = Activity.start "Benchmark" [ - "UseGetSource", this.UseGetSource.ToString() - "UseChangeNotifications", this.UseChangeNotifications.ToString() + "UseInMemoryDocuments", this.UseInMemoryDocuments.ToString() ] let first = "File001" let middle = $"File%03d{size / 2}" let last = $"File%03d{size}" - if this.UseGetSource && this.UseChangeNotifications then + if this.UseInMemoryDocuments then benchmark { updateFile first updatePublicSurface From 63cb950965ede43f5caa96ec4ba734937ba6abcb Mon Sep 17 00:00:00 2001 From: Petr Date: Mon, 8 Jan 2024 18:18:12 +0100 Subject: [PATCH 3/5] Speed up unused opens handling for empty results (#16502) * Speed up unused opens handling for empty results * Release notes --- .../.FSharp.Compiler.Service/8.0.200.md | 4 ++++ src/Compiler/Service/ServiceAnalysis.fs | 19 +++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/release-notes/.FSharp.Compiler.Service/8.0.200.md b/docs/release-notes/.FSharp.Compiler.Service/8.0.200.md index 701b6c0d2cc..72037533dfd 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/8.0.200.md +++ b/docs/release-notes/.FSharp.Compiler.Service/8.0.200.md @@ -15,3 +15,7 @@ * Parser recovers on unfinished record declarations. ([PR #16357](https://github.com/dotnet/fsharp/pull/16357)) * `MutableKeyword` to [SynFieldTrivia](../reference/fsharp-compiler-syntaxtrivia-synfieldtrivia.html) ([PR #16357](https://github.com/dotnet/fsharp/pull/16357)) * Added support for a new parameterless constructor for `CustomOperationAttribute`, which, when applied, will use method name as keyword for custom operation in computation expression builder. ([PR #16475](https://github.com/dotnet/fsharp/pull/16475), part of implementation for [fslang-suggestions/1250](https://github.com/fsharp/fslang-suggestions/issues/1250)) + +### Changed + +* Speed up unused opens handling for empty results. ([PR #16502](https://github.com/dotnet/fsharp/pull/16502)) diff --git a/src/Compiler/Service/ServiceAnalysis.fs b/src/Compiler/Service/ServiceAnalysis.fs index 16d9f953681..89569a802c8 100644 --- a/src/Compiler/Service/ServiceAnalysis.fs +++ b/src/Compiler/Service/ServiceAnalysis.fs @@ -297,12 +297,19 @@ module UnusedOpens = /// Async to allow cancellation. let getUnusedOpens (checkFileResults: FSharpCheckFileResults, getSourceLineStr: int -> string) : Async = async { - let! ct = Async.CancellationToken - let symbolUses = checkFileResults.GetAllUsesOfAllSymbolsInFile(ct) - let symbolUses = filterSymbolUses getSourceLineStr symbolUses - let symbolUses = splitSymbolUses symbolUses - let openStatements = getOpenStatements checkFileResults.OpenDeclarations - return! filterOpenStatements symbolUses openStatements + if checkFileResults.OpenDeclarations.Length = 0 then + return [] + else + let! ct = Async.CancellationToken + let symbolUses = checkFileResults.GetAllUsesOfAllSymbolsInFile(ct) + let symbolUses = filterSymbolUses getSourceLineStr symbolUses + let symbolUses = splitSymbolUses symbolUses + let openStatements = getOpenStatements checkFileResults.OpenDeclarations + + if openStatements.Length = 0 then + return [] + else + return! filterOpenStatements symbolUses openStatements } module SimplifyNames = From f0fb143017652f95384867ab288faf28b761bc21 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 9 Jan 2024 12:55:24 +0100 Subject: [PATCH 4/5] [main] Update dependencies from dotnet/source-build-reference-packages (#16500) * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240105.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24053.1 -> To Version 9.0.0-alpha.1.24055.1 * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240105.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24053.1 -> To Version 9.0.0-alpha.1.24055.1 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d1718cc9356..777911db583 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,9 +1,9 @@ - + https://github.com/dotnet/source-build-reference-packages - 5f670e45d060b25d5b07646dfcd94eae31893191 + ef691e3c401949dab9986a50d8288a6e489f72bb From 2fa2bd468dd98801ad7ffd34ef69d9832527feac Mon Sep 17 00:00:00 2001 From: Petr Date: Tue, 9 Jan 2024 16:18:02 +0100 Subject: [PATCH 5/5] Add perf notes archive (#16504) --- docs/perf-discussions-archive.md | 55 ++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 docs/perf-discussions-archive.md diff --git a/docs/perf-discussions-archive.md b/docs/perf-discussions-archive.md new file mode 100644 index 00000000000..47f6b14bae9 --- /dev/null +++ b/docs/perf-discussions-archive.md @@ -0,0 +1,55 @@ +This is just a typed version of [these notes](https://github.com/dotnet/fsharp/issues/16498), generated during perf discussions on summer of 2023. Can be used as a reference point. + +--- + +# Comparisons +- OCaml +- Scala +- C# +- Rust + +# Underlying problems +- LOH allocations +- Build does too much for deltas +- GC Gen 2 + +# Major problems +- Script start up CLI +- Build on Linux & Mac +- Glitches in test discovery +- Edit & test workflow +- Edit & run workflow +- Edit & check workflow +- Unnecessary rebuilds + +# Hosted compiler problems +- Stamp overflow +- Non-deterministic +- Memory leaks +- Infinite loops +- Stay resident compiler +- Permission elevation + +# Minor problems +- Benchmarking +- Squigglies +- Colorization +- Debug +- Press dot + +# Incremental phases +- Incremental parsing file +- Incremental checking file +- Incremental optimization for deltas +- Cascading DLL builds +- Incremental DLL builds +- Incremental ILxGen for deltas +- Incremental assembly generation +- Incremental PDB generation for deltas + +# Community guidelines +- Community leadership +- Community enablement for tool performance +- Performance acceptance criteria +- Performance running +- Docs for tooling performance \ No newline at end of file