From 707c8c708bb6f7427b1baeeef1a1f0e410021e3e Mon Sep 17 00:00:00 2001 From: Petr Date: Mon, 8 Jan 2024 14:38:27 +0100 Subject: [PATCH 1/3] Fixing and simplifying background compiler benchmarks --- tests/FSharp.Test.Utilities/ProjectGeneration.fs | 5 +---- .../BackgroundCompilerBenchmarks.fs | 7 +------ 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 73f7fd1f0e4..728f86fc808 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -783,7 +783,6 @@ type ProjectWorkflowBuilder initialProject: SyntheticProject, ?initialContext, ?checker: FSharpChecker, - ?useGetSource, ?useChangeNotifications, ?useSyntaxTreeCache, ?useTransparentCompiler, @@ -792,7 +791,6 @@ type ProjectWorkflowBuilder ) = let useTransparentCompiler = defaultArg useTransparentCompiler false - let useGetSource = not useTransparentCompiler && defaultArg useGetSource false let useChangeNotifications = not useTransparentCompiler && defaultArg useChangeNotifications false let autoStart = defaultArg autoStart true @@ -810,7 +808,7 @@ type ProjectWorkflowBuilder enableBackgroundItemKeyStoreAndSemanticClassification = true, enablePartialTypeChecking = true, captureIdentifiersWhenParsing = true, - documentSource = (if useGetSource then DocumentSource.Custom getSource else DocumentSource.FileSystem), + documentSource = (if useChangeNotifications then DocumentSource.Custom getSource else DocumentSource.FileSystem), useSyntaxTreeCache = defaultArg useSyntaxTreeCache false)) let mapProjectAsync f workflow = @@ -837,7 +835,6 @@ type ProjectWorkflowBuilder ProjectWorkflowBuilder( ctx.Project, ctx, - useGetSource = useGetSource, useChangeNotifications = useChangeNotifications, useTransparentCompiler = useTransparentCompiler, ?runTimeout = runTimeout) diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs index 3b44c1d37bf..a650c19f3bb 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs @@ -151,9 +151,6 @@ type NoFileSystemCheckerBenchmark() = let mutable benchmark : ProjectWorkflowBuilder = Unchecked.defaultof<_> - [] - member val UseGetSource = true with get,set - [] member val UseChangeNotifications = true with get,set @@ -165,7 +162,6 @@ type NoFileSystemCheckerBenchmark() = benchmark <- ProjectWorkflowBuilder( project, - useGetSource = this.UseGetSource, useChangeNotifications = this.UseChangeNotifications).CreateBenchmarkBuilder() [] @@ -178,7 +174,6 @@ type NoFileSystemCheckerBenchmark() = member this.ExampleWorkflow() = use _ = Activity.start "Benchmark" [ - "UseGetSource", this.UseGetSource.ToString() "UseChangeNotifications", this.UseChangeNotifications.ToString() ] @@ -186,7 +181,7 @@ type NoFileSystemCheckerBenchmark() = let middle = $"File%03d{size / 2}" let last = $"File%03d{size}" - if this.UseGetSource && this.UseChangeNotifications then + if this.UseChangeNotifications then benchmark { updateFile first updatePublicSurface From 51601fa94d0c9b076f8baee07f411cf5c05a652f Mon Sep 17 00:00:00 2001 From: Petr Date: Mon, 8 Jan 2024 16:26:06 +0100 Subject: [PATCH 2/3] up --- tests/FSharp.Test.Utilities/ProjectGeneration.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/FSharp.Test.Utilities/ProjectGeneration.fs b/tests/FSharp.Test.Utilities/ProjectGeneration.fs index 728f86fc808..73f7fd1f0e4 100644 --- a/tests/FSharp.Test.Utilities/ProjectGeneration.fs +++ b/tests/FSharp.Test.Utilities/ProjectGeneration.fs @@ -783,6 +783,7 @@ type ProjectWorkflowBuilder initialProject: SyntheticProject, ?initialContext, ?checker: FSharpChecker, + ?useGetSource, ?useChangeNotifications, ?useSyntaxTreeCache, ?useTransparentCompiler, @@ -791,6 +792,7 @@ type ProjectWorkflowBuilder ) = let useTransparentCompiler = defaultArg useTransparentCompiler false + let useGetSource = not useTransparentCompiler && defaultArg useGetSource false let useChangeNotifications = not useTransparentCompiler && defaultArg useChangeNotifications false let autoStart = defaultArg autoStart true @@ -808,7 +810,7 @@ type ProjectWorkflowBuilder enableBackgroundItemKeyStoreAndSemanticClassification = true, enablePartialTypeChecking = true, captureIdentifiersWhenParsing = true, - documentSource = (if useChangeNotifications then DocumentSource.Custom getSource else DocumentSource.FileSystem), + documentSource = (if useGetSource then DocumentSource.Custom getSource else DocumentSource.FileSystem), useSyntaxTreeCache = defaultArg useSyntaxTreeCache false)) let mapProjectAsync f workflow = @@ -835,6 +837,7 @@ type ProjectWorkflowBuilder ProjectWorkflowBuilder( ctx.Project, ctx, + useGetSource = useGetSource, useChangeNotifications = useChangeNotifications, useTransparentCompiler = useTransparentCompiler, ?runTimeout = runTimeout) From 8a9124586f52cf31c70a8c1a7ead4170e4e8a5e9 Mon Sep 17 00:00:00 2001 From: Petr Date: Mon, 8 Jan 2024 16:28:24 +0100 Subject: [PATCH 3/3] Rename --- .../BackgroundCompilerBenchmarks.fs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs index a650c19f3bb..a6ce4b36487 100644 --- a/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs +++ b/tests/benchmarks/FCSBenchmarks/CompilerServiceBenchmarks/BackgroundCompilerBenchmarks.fs @@ -152,7 +152,7 @@ type NoFileSystemCheckerBenchmark() = let mutable benchmark : ProjectWorkflowBuilder = Unchecked.defaultof<_> [] - member val UseChangeNotifications = true with get,set + member val UseInMemoryDocuments = true with get,set [] member val EmptyCache = true with get,set @@ -162,7 +162,8 @@ type NoFileSystemCheckerBenchmark() = benchmark <- ProjectWorkflowBuilder( project, - useChangeNotifications = this.UseChangeNotifications).CreateBenchmarkBuilder() + useGetSource = this.UseInMemoryDocuments, + useChangeNotifications = this.UseInMemoryDocuments).CreateBenchmarkBuilder() [] member this.EditFirstFile_OnlyInternalChange() = @@ -174,14 +175,14 @@ type NoFileSystemCheckerBenchmark() = member this.ExampleWorkflow() = use _ = Activity.start "Benchmark" [ - "UseChangeNotifications", this.UseChangeNotifications.ToString() + "UseInMemoryDocuments", this.UseInMemoryDocuments.ToString() ] let first = "File001" let middle = $"File%03d{size / 2}" let last = $"File%03d{size}" - if this.UseChangeNotifications then + if this.UseInMemoryDocuments then benchmark { updateFile first updatePublicSurface