Skip to content

[Perf] Windows/x64: 11 Regressions on 9/4/2025 12:05:32 AM +00:00 #119499

Closed

Description

@performanceautofiler

Run Information

Name Value
Architecture x64
OS Windows 10.0.22621
Queue TigerWindows
Baseline b8fe8055082e510992c51b15556ba84842f32f81
Compare aafa7f842f00021d32ff0c3045559f2602f41188
Diff Diff
Configs CompilationMode:tiered, RunKind:micro

Regressions in System.ComponentModel.Tests.Perf_TypeDescriptorTests

Benchmark Baseline Test Test/Base Test Quality Edge Detector Baseline IR Compare IR IR Ratio
81.57 ns 153.37 ns 1.88 0.05 False
53.77 ns 126.25 ns 2.35 0.04 False
53.81 ns 124.68 ns 2.32 0.04 False
81.66 ns 154.60 ns 1.89 0.04 False
81.21 ns 154.57 ns 1.90 0.03 False
87.94 ns 155.27 ns 1.77 0.02 False
81.24 ns 153.83 ns 1.89 0.04 False
79.39 ns 152.90 ns 1.93 0.03 False
45.32 ns 123.11 ns 2.72 0.41 False
53.26 ns 126.62 ns 2.38 0.05 False
99.02 ns 184.74 ns 1.87 0.07 False

graph
graph
graph
graph
graph
graph
graph
graph
graph
graph
graph
Test Report

Repro

General Docs link: https://github.com/dotnet/performance/blob/main/docs/benchmarking-workflow-dotnet-runtime.md

git clone https://github.com/dotnet/performance.git
py .\performance\scripts\benchmarks_ci.py -f net8.0 --filter 'System.ComponentModel.Tests.Perf_TypeDescriptorTests*'
Details

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.ComponentModel.Tests.DerivedClass))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.ComponentModel.Tests.ClassWithNoConverter))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(string))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.Guid))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.Enum))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(int?))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.ComponentModel.Tests.SomeValueType?))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(int))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.ComponentModel.Tests.IDerived))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.ComponentModel.Tests.ClassIDerived))

ETL Files

Histogram

JIT Disasms

System.ComponentModel.Tests.Perf_TypeDescriptorTests.GetConverter(typeToConvert: typeof(System.ComponentModel.Tests.SomeEnum))

ETL Files

Histogram

JIT Disasms

Docs

Profiling workflow for dotnet/runtime repository
Benchmarking workflow for dotnet/runtime repository

Activity

  1. added
    runtime-coreclr
    untriaged
    on Sep 9, 2025
  2. added
    tenet-performance
    tenet-performance-benchmarks
    on Sep 9, 2025
  3. dotnet-policy-service commented on Sep 9, 2025

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @dotnet/area-system-componentmodel
    See info in area-owners.md if you want to be subscribed.

  4. ericstj commented on Sep 15, 2025

    @ericstj
    Member

    @alexey-zakharov this seems to be caused by #114619

    I confirmed the regression. I thought it might have been solely caused by the change in implementation of WeakHashTable but reverting just that still shows a regression. Here's a local repro of this, benchmarking just GetConverter(int32).

    Method Job Toolchain typeToConvert Mean Error StdDev Ratio
    GetConverter Job-AFEPJS \net10.0-windows-Release-x64-bad\shared\Microsoft.NETCore.App\10.0.0\corerun.exe Int32 105.46 ns 0.180 ns 0.168 ns 1.00
    GetConverter Job-KQGOHS \net10.0-windows-Release-x64-good\shared\Microsoft.NETCore.App\10.0.0\corerun.exe Int32 70.55 ns 0.425 ns 0.398 ns 0.67
    GetConverter Job-CJPJGN \net10.0-windows-Release-x64\shared\Microsoft.NETCore.App\10.0.0\corerun.exe Int32 102.07 ns 0.931 ns 0.825 ns 0.97

    I'm having a look at a different solution here that preserves the fix but doesn't regress the hotpath.

  5. ericstj commented on Sep 15, 2025

    @ericstj
    Member

    Just the following change will fix the regression:

    --- a/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
    +++ b/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs
    @@ -2,6 +2,7 @@
     // The .NET Foundation licenses this file to you under the MIT license.
    
     using System.Collections;
    +using System.Collections.Concurrent;
     using System.Collections.Generic;
     using System.Collections.Specialized;
     using System.ComponentModel.Design;
    @@ -66,7 +67,8 @@ public sealed class TypeDescriptor
             internal static readonly object s_commonSyncObject = new object();
    
             // A direct mapping from type to provider.
    -        private static readonly CollectibleKeyConcurrentHashtable<Type, TypeDescriptionNode> s_providerTypeTable = new CollectibleKeyConcurrentHashtable<Type, TypeDescriptionNode>();
    +        // private static readonly CollectibleKeyConcurrentHashtable<Type, TypeDescriptionNode> s_providerTypeTable = new CollectibleKeyConcurrentHashtable<Type, TypeDescriptionNode>();
    +        private static readonly ConcurrentDictionary<Type, TypeDescriptionNode> s_providerTypeTable = new ConcurrentDictionary<Type, TypeDescriptionNode>();
    
             // Tracks DefaultTypeDescriptionProviderAttributes.
             // A value of `null` indicates initialization is in progress.

    So I might have a look at CollectibleKeyConcurrentHashtable to see if there is opportunity for optimization.

  6. ericstj commented on Sep 15, 2025

    @ericstj
    Member

    It appears this cost is coming from the !key.IsCollectible check. Leaving all else in place, removing this check from CollectibleKeyConcurrentHashtable TryGetValue and TryAdd will resolve the regression (identified as hot-path in NodeFor method). Adding this back, even as _ = !key.IsCollectible; will bring back the regression.

    Let me see about adding IsCollectible to the RuntimeTypeCache

  7. added a commit that references this issue on Sep 16, 2025
    0d97ceb
  8. alexey-zakharov commented on Sep 16, 2025

    @alexey-zakharov
    Contributor

    thanks @ericstj for taking a look!
    it seems that the change is great, just needs to take into account thread safety.

  9. removed
    untriaged
    on Sep 16, 2025
  10. locked and limited conversation to collaborators on Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-x64area-System.ComponentModelos-windowsruntime-coreclrtenet-performancetenet-performance-benchmarks

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions