Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Coverlet instrumentation becomes slow after installing dotnet sdk 8.0.200 #1620

Closed
thinkbeforecoding opened this issue Feb 16, 2024 · 11 comments
Labels
duplicate This issue or pull request already exists needs more info More details are needed

Comments

@thinkbeforecoding
Copy link

thinkbeforecoding commented Feb 16, 2024

Describe the bug
The tests using coverlet used to be correctly fast, but since installing dotnet sdk 8.0.200 (released on 2024-02-13), the time skyrocketed from 15 seconds to > 7min. This is happening on two different tests projects which are not especially large.

To Reproduce
Hard to say, some other projects have not significantly changed. I suspect that these projects contain a few large methods (using nested inline methods in F#), but it used to be instrumented far faster.

Expected behavior
Instrumentation time should remain in the same range as before.

Actual behavior
The time in instrumentation is very long:

Project Evaluation Performance Summary:
      125 ms  D:\dev\app\Connectivity.Dispatcher.Proto\Connectivity.Dispatcher.Proto.csproj   2 calls
      255 ms  D:\dev\app\Connectivity.Planning\Connectivity.Planning.fsproj   2 calls
      323 ms  D:\dev\app\Connectivity.Planning.Test\Connectivity.Planning.Test.fsproj   3 calls
      404 ms  D:\dev\app\NATS.OpenTelemetry\NATS.OpenTelemetry.fsproj   6 calls

Project Performance Summary:
     2498 ms  D:\dev\app\Connectivity.Dispatcher.Proto\Connectivity.Dispatcher.Proto.csproj   9 calls
                  2 ms  _GenerateRestoreProjectPathWalk            1 calls
                  0 ms  _IsProjectRestoreSupported                 1 calls
                 86 ms  _GenerateRestoreGraphProjectEntry          1 calls
                  6 ms  _GenerateProjectRestoreGraph               1 calls
                  3 ms  GetTargetFrameworks                        1 calls
                  1 ms  GetNativeManifest                          1 calls
                  0 ms  InitializeSourceRootMappedPaths            1 calls
                  0 ms  GetCopyToOutputDirectoryItems              1 calls
     3868 ms  D:\dev\app\NATS.OpenTelemetry\NATS.OpenTelemetry.fsproj  23 calls
                168 ms  _GenerateRestoreProjectPathWalk            1 calls
                  2 ms  _GenerateRestoreProjectPathItemsPerFramework   2 calls
                  0 ms  _IsProjectRestoreSupported                 1 calls
                 19 ms  _GenerateRestoreGraphProjectEntry          1 calls
                  0 ms  _GetRestoreSettingsPerFramework            2 calls
                 56 ms  _GenerateProjectRestoreGraph               1 calls
                  0 ms  GetAllRuntimeIdentifiers                   2 calls
                 45 ms  _GenerateProjectRestoreGraphPerFramework   2 calls
                214 ms  GetTargetFrameworks                        2 calls
                 13 ms  GetTargetFrameworksWithPlatformForSingleTargetFramework   2 calls
                  0 ms  GetNativeManifest                          2 calls
                  0 ms  GetCopyToOutputDirectoryItems              2 calls
                  0 ms  InitializeSourceRootMappedPaths            1 calls
    13905 ms  D:\dev\app\Connectivity.Planning\Connectivity.Planning.fsproj   9 calls
                228 ms  _GenerateRestoreProjectPathWalk            1 calls
                  0 ms  _IsProjectRestoreSupported                 1 calls
                 95 ms  _GenerateRestoreGraphProjectEntry          1 calls
                  7 ms  _GenerateProjectRestoreGraph               1 calls
                  5 ms  GetTargetFrameworks                        1 calls
                  0 ms  GetNativeManifest                          1 calls
                  0 ms  InitializeSourceRootMappedPaths            1 calls
                  0 ms  GetCopyToOutputDirectoryItems              1 calls
    405015 ms  D:\dev\app\Connectivity.Planning.Test\Connectivity.Planning.Test.fsproj   8 calls
               1442 ms  Restore                                    1 calls
                  1 ms  _IsProjectRestoreSupported                 2 calls
                747 ms  _GenerateRestoreProjectPathWalk            1 calls
                 24 ms  _GenerateRestoreGraphProjectEntry          1 calls
                 11 ms  _GenerateProjectRestoreGraph               1 calls
              385634 ms  VSTest                                     1 calls

Target Performance Summary:
        0 ms  _Protobuf_Compile_BeforeCsCompile          1 calls
        0 ms  InstrumentModulesAfterBuild                1 calls
        0 ms  GenerateCoverageResultAfterTest            1 calls
        0 ms  Protobuf_Compile                           1 calls
        0 ms  AfterBuild                                 4 calls
        0 ms  Protobuf_AfterCompile                      1 calls
        0 ms  PrepareResourceNames                       4 calls
        0 ms  BeforeBuild                                4 calls
        0 ms  ResGen                                     4 calls
        0 ms  Protobuf_BeforeCompile                     1 calls
        0 ms  _ChooseAppHost                             1 calls
        0 ms  GenerateMSBuildEditorConfigFile            1 calls
        0 ms  BeforeResGen                               4 calls
        0 ms  CreateSatelliteAssemblies                  4 calls
        0 ms  Compile                                    4 calls
        0 ms  BeforeCompile                              4 calls
        0 ms  CoreBuild                                  4 calls
        0 ms  _InitializeSourceRootMappedPathsFromSourceControl   4 calls
        0 ms  _CopySourceItemsToOutputDirectory          4 calls
        0 ms  PrepareResources                           4 calls
        0 ms  ResolvePackageDependenciesForBuild         4 calls
        0 ms  PrepareForRun                              4 calls
        0 ms  _SetEmbeddedFilesFromSourceControlManagerUntrackedFiles   4 calls
        0 ms  AfterResGen                                4 calls
        0 ms  CreateCustomManifestResourceNames          4 calls
        0 ms  ValidateCommandLineProperties              4 calls
        0 ms  GetTargetPath                              4 calls
        0 ms  PrepareProjectReferences                   4 calls
        0 ms  GetReferenceAssemblyPaths                  4 calls
        0 ms  GetFrameworkPaths                          4 calls
        0 ms  GenerateSourceLinkFile                     4 calls
        0 ms  SetWin32ManifestProperties                 4 calls
        0 ms  _InitializeSourceRootMappedPathsOpt        4 calls
        0 ms  _SetTargetFrameworkMonikerAttribute        1 calls
        0 ms  _CheckForUnsupportedTargetFrameworkAndFeatureCombination   1 calls
        0 ms  _GenerateRestoreGraphProjectEntry          4 calls
        0 ms  AfterResolveReferences                     4 calls
        0 ms  _Protobuf_SanityCheck                      1 calls
        0 ms  AfterCompile                               4 calls
        0 ms  Build                                      4 calls
        0 ms  _BeforeVBCSCoreCompile                     1 calls
        0 ms  _InitializeSourceControlInformationFromSourceControlManager   4 calls
        0 ms  Protobuf_PrepareCompileOptions             1 calls
        0 ms  gRPC_ResolvePluginFullPath                 1 calls
        0 ms  GenerateAssemblyInfo                       4 calls
        0 ms  _GetRestoreSettingsCurrentProject          3 calls
        0 ms  BeforeResolveReferences                    4 calls
        0 ms  _Protobuf_GatherStaleFiles                 1 calls
        0 ms  BuildOnlySettings                          4 calls
        0 ms  _GenerateProjectRestoreGraphCurrentProject   3 calls
        0 ms  CopyAdditionalFiles                        1 calls
        0 ms  _AddOutputPathToGlobalPropertiesToRemove   4 calls
        0 ms  _CheckForMismatchingPlatform               1 calls
        0 ms  _Microsoft_Extensions_Configuration_Binder_RemoveAnalyzer   3 calls
        0 ms  EnableIntermediateOutputPathMismatchWarning   4 calls
        0 ms  _GenerateRestoreProjectPathItemsCurrentProject   3 calls
        0 ms  _gRPC_PrepareCompileOptions                1 calls
        0 ms  _ReportUpgradeNetAnalyzersNuGetWarning     1 calls
        0 ms  _Protobuf_GatherStaleSimple                1 calls
        0 ms  _SetSourceLinkFilePath                     4 calls
        0 ms  ResolveLockFileAnalyzers                   4 calls
        0 ms  _GenerateProjectRestoreGraph               4 calls
        0 ms  _PopulateCommonStateForGetCopyToOutputDirectoryItems   4 calls
        0 ms  _GenerateRestoreDependencies               4 calls
        0 ms  _ComputeSkipAnalyzers                      1 calls
        0 ms  AddDepsJsonAndRuntimeConfigToCopyItemsForReferencingProjects   2 calls
        0 ms  IncludeTransitiveProjectReferences         4 calls
        0 ms  _Protobuf_SelectFiles                      1 calls
        0 ms  GenerateMSBuildEditorConfigFileShouldRun   1 calls
        0 ms  _GetAppHostPaths                           1 calls
        0 ms  _CheckForUnsupportedHostingUsage           4 calls
        0 ms  InitializeSourceControlInformation         4 calls
        0 ms  _CheckAndUnsetUnsupportedPrefer32Bit       3 calls
        0 ms  ResolveSDKReferences                       4 calls
        0 ms  ExpandSDKReferences                        4 calls
        0 ms  _DefaultMicrosoftNETPlatformLibrary        4 calls
        0 ms  AddImplicitDefineConstants                 4 calls
        0 ms  _GetRestoreTargetFrameworksAsItems         1 calls
        0 ms  _ComputeNETCoreBuildOutputFiles            4 calls
        0 ms  _Protobuf_EnforceInvariants                1 calls
        0 ms  _CheckForUnsupportedArtifactsPath          4 calls
        0 ms  _IsProjectRestoreSupported                 4 calls
        0 ms  IgnoreJavaScriptOutputAssembly             4 calls
        0 ms  _GetRestoreSettingsPerFramework            5 calls
        0 ms  _CheckForObsoleteDotNetCliToolReferences   9 calls
        0 ms  CollectFrameworkReferences                 5 calls
        1 ms  _CheckForUnsupportedCppNETCoreVersion     10 calls
        1 ms  GetNativeManifest                          3 calls
        1 ms  _GetRestoreSettingsOverrides               4 calls
        1 ms  GetTargetPathWithTargetPlatformMoniker     4 calls
        1 ms  AddSourceRevisionToInformationalVersion    4 calls
        1 ms  SourceControlManagerPublishTranslatedUrls   4 calls
        1 ms  _Protobuf_AugmentLanguageCompile           1 calls
        1 ms  _LoadRestoreGraphEntryPoints               1 calls
        1 ms  _CheckForUnsupportedAppHostUsage           2 calls
        1 ms  ShowCallOfVSTestTaskWithParameter          1 calls
        1 ms  ResolveReferences                          4 calls
        1 ms  _Protobuf_CoreCompile                      1 calls
        1 ms  _CheckForCompileOutputs                    4 calls
        1 ms  _GetProjectJsonPath                       10 calls
        1 ms  _CheckForLanguageAndFeatureCombinationSupport   9 calls
        1 ms  _GenerateRuntimeConfigurationFilesInputCache   2 calls
        1 ms  CollectCentralPackageVersions              5 calls
        1 ms  _CheckContainersPackage                    4 calls
        1 ms  _CheckForUnsupportedNETCoreVersion         9 calls
        1 ms  ShowMsbuildWithParameter                   1 calls
        1 ms  Protobuf_ReconcileOutputs                  1 calls
        1 ms  _GenerateSatelliteAssemblyInputs           4 calls
        1 ms  _ComputePackageReferencePublish            4 calls
        1 ms  _SplitProjectReferencesByFileExistence     4 calls
        1 ms  _GenerateCompileInputs                     4 calls
        1 ms  GetAssemblyAttributes                      4 calls
        1 ms  _AddMicrosoftNetCompilerToolsetFrameworkPackage   9 calls
        1 ms  CoreResGen                                 4 calls
        2 ms  IncludeTargetingPackReference              1 calls
        2 ms  _GetRestoreTargetFrameworkOverride         4 calls
        2 ms  _GetFrameworkAssemblyReferences            3 calls
        2 ms  _Protobuf_SetProtoRoot                     1 calls
        2 ms  _GenerateRestoreSpecs                      4 calls
        2 ms  ValidateExecutableReferences               3 calls
        2 ms  _GetCopyToOutputDirectoryItemsFromThisProject   4 calls
        2 ms  _GenerateRestoreProjectPathItems           4 calls
        2 ms  _Protobuf_GatherStaleBatched               2 calls
        2 ms  AddGlobalAnalyzerConfigForPackage_MicrosoftCodeAnalysisNetAnalyzers   1 calls
        2 ms  CollectPackageDownloads                    5 calls
        2 ms  _CheckForInvalidConfigurationAndPlatform   4 calls
        2 ms  GetAssemblyVersion                         4 calls
        2 ms  _ComputeUserRuntimeAssemblies              4 calls
        3 ms  ResolveLockFileCopyLocalFiles              4 calls
        3 ms  Protobuf_ResolvePlatform                   1 calls
        3 ms  ReferencedPathMaps                         1 calls
        3 ms  GenerateProgramFile                        2 calls
        3 ms  _BlockWinMDsOnUnsupportedTFMs              4 calls
        3 ms  GetTargetFrameworks                        3 calls
        3 ms  SplitResourcesByCulture                    4 calls
        3 ms  _GenerateDotnetCliToolReferenceSpecs       4 calls
        4 ms  GetAllRuntimeIdentifiers                   3 calls
        4 ms  CollectFSharpDesignTimeTools               3 calls
        4 ms  AssignProjectConfiguration                 2 calls
        4 ms  _GetRestoreTargetFrameworksOutput          4 calls
        4 ms  _CollectTargetFrameworkForTelemetry        5 calls
        4 ms  InitializeSourceRootMappedPaths            4 calls
        5 ms  GenerateTargetFrameworkMonikerAttribute    4 calls
        5 ms  _SourceLinkHasSingleProvider               4 calls
        5 ms  ResolveOffByDefaultAnalyzers               4 calls
        5 ms  _CopyOutOfDateSourceItemsToOutputDirectory   2 calls
        5 ms  GenerateMSBuildEditorConfigFileCore        1 calls
        6 ms  CheckForImplicitPackageReferenceOverrides   9 calls
        6 ms  CheckForDuplicateItems                     4 calls
        6 ms  ResolveLockFileReferences                  4 calls
        6 ms  Protobuf_PrepareCompile                    1 calls
        6 ms  IncrementalClean                           4 calls
        6 ms  _GetCopyToOutputDirectoryItemsFromTransitiveProjectReferences   4 calls
        6 ms  _GenerateRestoreProjectSpec                4 calls
        7 ms  ResolveRuntimePackAssets                   1 calls
        7 ms  GenerateNETCompatibleDefineConstants       4 calls
        7 ms  _ComputeToolPackInputsToProcessFrameworkReferences   9 calls
        7 ms  GenerateGlobalUsings                       1 calls
        8 ms  SetPaketCommand                           10 calls
        8 ms  _GenerateCompileDependencyCache            4 calls
        8 ms  AssignTargetPaths                          4 calls
        8 ms  _SetEmbeddedWin32ManifestProperties        4 calls
        8 ms  PrepareForBuild                            4 calls
        8 ms  _ComputeReferenceAssemblies                4 calls
        8 ms  _GenerateSourceLinkFile                    4 calls
        9 ms  ApplyImplicitVersions                      9 calls
        9 ms  CreateGeneratedAssemblyInfoInputsCacheFile   4 calls
        9 ms  _GetRestoreProjectStyle                   10 calls
       11 ms  TranslateGitLabUrlsInSourceControlInformation   4 calls
       11 ms  NETStandardCompatError_Microsoft_Extensions_Configuration_Binder   5 calls
       11 ms  TranslateBitbucketGitUrlsInSourceControlInformation   4 calls
       12 ms  TranslateAzureReposGitUrlsInSourceControlInformation   4 calls
       12 ms  GetTargetFrameworksWithPlatformForSingleTargetFramework   4 calls
       13 ms  UpdateAspNetToFrameworkReference           8 calls
       13 ms  TranslateGitHubUrlsInSourceControlInformation   4 calls
       13 ms  _CreateAppHost                             1 calls
       13 ms  GenerateFSharpTextResources                3 calls
       14 ms  _GenerateProjectRestoreGraphPerFramework   5 calls
       15 ms  _GetRestoreSettingsAllFrameworks           1 calls
       16 ms  CollectPackageReferences                  10 calls
       16 ms  _InitializeGitHubSourceLinkUrl            12 calls
       16 ms  ResolveFrameworkReferences                 4 calls
       16 ms  _CleanGetCurrentAndPriorFileWrites         4 calls
       17 ms  GetCopyToOutputDirectoryItems              4 calls
       17 ms  _InitializeAzureReposGitSourceLinkUrl     12 calls
       18 ms  _GenerateRestoreProjectPathItemsPerFramework   5 calls
       18 ms  _ComputeTargetFrameworkItems               1 calls
       19 ms  _InitializeGitLabSourceLinkUrl            12 calls
       21 ms  RedirectTPReferenceToNewRedistributableLocation   3 calls
       25 ms  SetEmbeddedFilesFromSourceControlManagerUntrackedFiles   4 calls
       25 ms  ResolveTargetingPackAssets                 4 calls
       29 ms  GenerateBuildRuntimeConfigurationFiles     2 calls
       32 ms  CopyFilesToOutputDirectory                 4 calls
       32 ms  RedirectFSharpCoreReferenceToNewRedistributableLocation   3 calls
       34 ms  _CopyFilesMarkedCopyLocal                  2 calls
       36 ms  _InitializeBitbucketGitSourceLinkUrl      12 calls
       42 ms  CoreGenerateAssemblyInfo                   4 calls
       50 ms  _FilterRestoreGraphProjectInputItems       1 calls
       50 ms  _GenerateProjectRestoreGraphAllFrameworks   1 calls
       51 ms  _HandlePackageFileConflicts                4 calls
       51 ms  _GetRestoreSettings                        4 calls
       75 ms  InitializeSourceControlInformationFromSourceControlManager   4 calls
       93 ms  FindReferenceAssembliesForReferences       4 calls
      104 ms  ProcessFrameworkReferences                 8 calls
      124 ms  GenerateBuildDependencyFile                4 calls
      126 ms  _GenerateRestoreProjectPathItemsAllFrameworks   1 calls
      127 ms  ResolveAssemblyReferences                  4 calls
      143 ms  PaketRestore                              10 calls
      153 ms  ResolvePackageAssets                       4 calls
      191 ms  GetTargetFrameworksWithPlatformFromInnerBuilds   1 calls
      194 ms  _GenerateRestoreGraph                      1 calls
      344 ms  GenerateCoverageResult                     1 calls
      425 ms  Restore                                    1 calls
      621 ms  _GetProjectReferenceTargetFrameworkProperties   4 calls
      757 ms  _GetAllRestoreProjectPathItems             1 calls
      953 ms  _GenerateRestoreProjectPathWalk            4 calls
    16941 ms  ResolveProjectReferences                   4 calls
    17165 ms  BuildProject                               1 calls
    17510 ms  CoreCompile                                4 calls
    366551 ms  InstrumentModules                          1 calls
    385287 ms  _VSTestConsole                             1 calls
    385289 ms  VSTest                                     1 calls

Task Performance Summary:
        1 ms  VSTestLogsTask                             2 calls
        1 ms  GetReferenceAssemblyPaths                  1 calls
        1 ms  Microsoft.CodeAnalysis.BuildTasks.MapSourceRoots   1 calls
        1 ms  NuGetMessageTask                           1 calls
        1 ms  AssignCulture                              4 calls
        1 ms  GetAssemblyVersion                         4 calls
        1 ms  GenerateMSBuildEditorConfig                1 calls
        1 ms  GetGlobalPropertyValueTask                 1 calls
        1 ms  ProtoToolsPlatform                         1 calls
        1 ms  Delete                                     4 calls
        1 ms  ValidateExecutableReferences               3 calls
        1 ms  GetRestorePackageDownloadsTask             5 calls
        1 ms  SetRidAgnosticValueForProjects             4 calls
        1 ms  WarnForInvalidProjectsTask                 1 calls
        1 ms  GetRestoreFrameworkReferencesTask          5 calls
        1 ms  FindAppConfigFile                          4 calls
        1 ms  CombineXmlElements                         3 calls
        2 ms  CheckForUnsupportedWinMDReferences         4 calls
        2 ms  Microsoft.SourceLink.Common.SourceLinkHasSingleProvider   4 calls
        2 ms  ResolveFrameworkReferences                 4 calls
        2 ms  MapSourceRoots                             3 calls
        2 ms  CreateProperty                            10 calls
        2 ms  AllowEmptyTelemetry                        5 calls
        2 ms  GetRestoreProjectReferencesTask            5 calls
        2 ms  GetRestoreDotnetCliToolsTask               4 calls
        2 ms  Touch                                      3 calls
        2 ms  CheckForDuplicateFrameworkReferences       8 calls
        2 ms  FSharpEmbedResourceText                    3 calls
        2 ms  AssignProjectConfiguration                 2 calls
        2 ms  FSharpEmbedResXSource                      3 calls
        2 ms  GetProjectTargetFrameworksTask             4 calls
        3 ms  ProtoCompilerOutputs                       1 calls
        3 ms  JoinItems                                  4 calls
        3 ms  ProtoReadDependencies                      1 calls
        3 ms  CheckForImplicitPackageReferenceOverrides   9 calls
        4 ms  ApplyImplicitVersions                      9 calls
        4 ms  GetRestorePackageReferencesTask            5 calls
        4 ms  AssignTargetPath                          24 calls
        4 ms  CheckForDuplicateItems                    12 calls
        4 ms  Message                                   46 calls
        5 ms  CheckIfPackageReferenceShouldBeFrameworkReference  16 calls
        5 ms  Hash                                      10 calls
        5 ms  GetRestoreProjectStyleTask                10 calls
        5 ms  GenerateGlobalUsings                       1 calls
        5 ms  ResolveRuntimePackAssets                   1 calls
        5 ms  RemoveDuplicates                          19 calls
        6 ms  GetFrameworkPath                           4 calls
        6 ms  ConvertToAbsolutePath                     13 calls
        7 ms  CopyRefAssembly                            4 calls
        7 ms  Microsoft.SourceLink.Common.GenerateSourceLinkFile   4 calls
        7 ms  Microsoft.SourceLink.GitLab.TranslateRepositoryUrls   4 calls
        7 ms  FindUnderPath                             22 calls
        7 ms  CheckForDuplicateNuGetItemsTask           20 calls
        7 ms  Microsoft.SourceLink.AzureRepos.Git.TranslateRepositoryUrls   4 calls
        7 ms  Microsoft.SourceLink.Bitbucket.Git.TranslateRepositoryUrls   4 calls
        8 ms  WriteLinesToFile                          12 calls
        8 ms  MakeDir                                   10 calls
        8 ms  ResolveAppHosts                            8 calls
        9 ms  Microsoft.SourceLink.GitHub.TranslateRepositoryUrls   4 calls
        9 ms  CombineTargetFrameworkInfoProperties       4 calls
       10 ms  GetPackageDirectory                       40 calls
       10 ms  ReadLinesFromFile                         25 calls
       12 ms  CreateAppHost                              1 calls
       13 ms  Microsoft.SourceLink.GitHub.GetSourceLinkUrl  12 calls
       14 ms  Microsoft.SourceLink.AzureRepos.Git.GetSourceLinkUrl  12 calls
       15 ms  Microsoft.SourceLink.Bitbucket.Git.GetSourceLinkUrl  12 calls
       16 ms  Microsoft.SourceLink.GitLab.GetSourceLinkUrl  12 calls
       18 ms  GetFileHash                               10 calls
       23 ms  ResolveTargetingPackAssets                 4 calls
       23 ms  Microsoft.Build.Tasks.Git.GetUntrackedFiles   4 calls
       28 ms  GenerateRuntimeConfigurationFiles          2 calls
       31 ms  GetReferenceNearestTargetFrameworkTask     3 calls
       37 ms  ResolvePackageFileConflicts                4 calls
       39 ms  WriteCodeFragment                          3 calls
       50 ms  GetRestoreSettingsTask                     4 calls
       52 ms  Copy                                      14 calls
       72 ms  Microsoft.Build.Tasks.Git.LocateRepository   4 calls
       85 ms  ProcessFrameworkReferences                 8 calls
      120 ms  GenerateDepsFile                           3 calls
      123 ms  ResolveAssemblyReference                   4 calls
      145 ms  ResolvePackageAssets                       4 calls
      343 ms  Coverlet.MSbuild.Tasks.CoverageResultTask   1 calls
      424 ms  RestoreTask                                1 calls
     1569 ms  VSTestTask                                 1 calls
     2038 ms  Csc                                        1 calls
    15464 ms  Fsc                                        3 calls
    36938 ms  MSBuild                                   34 calls
    366550 ms  Coverlet.MSbuild.Tasks.InstrumentationTask   1 calls
    769021 ms  CallTarget                                12 calls

Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* coverlet.msbuild - 6.0
* problem appearing with: dotnet sdk 8.0.200 / dotnet runtime 8.0.2
* previously worked with dotnet sdk 8.0.102 / dotnet runtime 8.0.1
* Windows and Linux
* x64
* It seems to be linked to dotnet 8.0.200

Additional context
The only specific thing in the test dependency is a few methods that can be highly inlined at compilation (using F# inline keyword) and can be large. Other projects don't seem to be as much impacted.

@github-actions github-actions bot added the untriaged To be investigated label Feb 16, 2024
@Bertk
Copy link
Collaborator

Bertk commented Feb 17, 2024

Thanks for reporting this.
Could you please use the latest coverlet.msbuild preview and check the performance.

@Bertk Bertk added the needs more info More details are needed label Feb 17, 2024
@thinkbeforecoding
Copy link
Author

thinkbeforecoding commented Feb 20, 2024

I've done tests with the preview nuget and they show no improvements, sadly.

@daveMueller
Copy link
Collaborator

OK that's really interesting. I can remember that we had other issues reported with inlined methods some time ago, e.g. #1225. Probably they changed something there, more generated code, emitted additional sequence points...
It would be helpful if somebody could provide a simple repro where this increased instrumentation time can be seen when switching between 8.0.1 - 8.0.2.

@thinkbeforecoding
Copy link
Author

I have no independent repro yet, but I used perfview to see what the process was doing (this last like 8 or 9 minutes, while it was a few seconds before)
image

The sampling was done on 17 sec.

@thinkbeforecoding
Copy link
Author

A flame graph on a similar sample:
image

@thinkbeforecoding
Copy link
Author

And another one :
image

@thinkbeforecoding
Copy link
Author

So, after more test, it found that is was truly linked to the size of methods due to F# inlining.

Two keypoints:

  • The code emitted by F# in debug in my case is far larger than expected. F# usually optimizes dead branches (if true then ... / if false then ...) even in debug. But in my case it seems to not do it. This inflates the size of the functions artificially. The library I use relies on these static branch elimination with deep inlining. The final code is actually short, but becomes enormous if this optimization is disabled. Has this changed in recent F# release ? I'll check and ask the question.
  • However, as I repeated multiple times the same line to generate a large method to test, I noticed that the time was not increasing linearly with the number of repeated lines. Up to 8 times, instrumentation was instant. at 9 its taking 1sec, at 10, 2.5 sec. At 14 taking 20sec.. at 20 several minutes. There is probably something in n² there...

A least, forcing the --optimize+ flag during F# compilation produces a far smaller IL (without all the dead branches), and the timing is back to normal.

@iCodeIT
Copy link

iCodeIT commented Apr 4, 2024

I have observed the same on a rather large C# solution. With .net 6 test runs in under 10 minutes. After updating to .net 8 I gave up on the tests after an hour. (When actual tests were running they were faster in .net8 than .ner6, so but it takes forever to get to the test, so I assume it is the.instrumentation that takes a long time)

@RicoSuter
Copy link

RicoSuter commented Apr 9, 2024

We also have problems with huge performance degradation... (unit test run from 2mins to 14mins)... it seems that downgrading to coverlet v6.0.1 fixes the problem and the problem is only with v6.0.2...

@thinkbeforecoding can you try whether this works for you as well?

@maxgruebneraeroqual
Copy link

We also noticed this on our medium size C# solution (68 projects), when we updated our coverlet version while using .net 8.

Dropping back to the previous version works.

Seems to take a minute or so to start test execution, for each test project. Note the column on the right is time since started. It normally takes ~10s in our CI system.

image

@Bertk
Copy link
Collaborator

Bertk commented Jul 22, 2024

Duplicate issue exists #1649

@Bertk Bertk added the duplicate This issue or pull request already exists label Jul 22, 2024
@Bertk Bertk removed the untriaged To be investigated label Aug 18, 2024
@Bertk Bertk closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists needs more info More details are needed
Projects
None yet
Development

No branches or pull requests

6 participants