Skip to content

Cold start for RX subscriptions is slower on .net10 #127687

Open

Description

@firenero

Description

During migration of WPF app from .net8 to .net10 we've noticed significant degradation in cold start performance in RX-heavy workflows. I've wrote sample benchmarks with many RX subscriptions that mostly aligns with benchmark results we see in our production app.

I've tested different versions of .net10 and it looks like 10.0.0 performs better than 10.0.7 in this benchmark. Since it's cold-start benchmark, it's not very stable but I was able to get similar results on two different CPUs (AMD 7950x and AMD 7950x3D).

Benchmark sources: https://github.com/firenero/DotNetRxBench

We have also noticed ~27% slower execution of our UI tests in .net 10 but I don't have any sample solution to share.

Regression?

Yes, both .net8 and .net9 perform better in this scenario.

Data

.NET 10.0.0 + AMD 7950x3D

// * Summary *

BenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.8246/25H2/2025Update/HudsonValley2)
AMD Ryzen 9 7950X3D 4.20GHz, 1 CPU, 32 logical and 16 physical cores
.NET SDK 10.0.100
  [Host]     : .NET 8.0.26 (8.0.26, 8.0.2626.16921), X64 RyuJIT x86-64-v4
  Job-AOJIKS : .NET 8.0.26 (8.0.26, 8.0.2626.16921), X64 RyuJIT x86-64-v4
  Job-HBMQMI : .NET 9.0.15 (9.0.15, 9.0.1526.17522), X64 RyuJIT x86-64-v4
  Job-EPQKMY : .NET 10.0.0 (10.0.0, 10.0.25.52411), X64 RyuJIT x86-64-v4

Server=False  IterationCount=1  LaunchCount=50
RunStrategy=ColdStart  WarmupCount=0
Method Runtime Mean Error StdDev Ratio RatioSD Allocated Alloc Ratio
ConstructAndInitialize .NET 8.0 116.6 ms 0.84 ms 1.70 ms 1.00 0.02 155.5 KB 1.00
ConstructAndInitialize .NET 9.0 115.4 ms 0.86 ms 1.74 ms 0.99 0.02 155.65 KB 1.00
ConstructAndInitialize .NET 10.0 129.2 ms 0.53 ms 1.07 ms 1.11 0.02 203.73 KB 1.31

.NET 10.0.7 + AMD 7950x3D

// * Summary *

BenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.8246/25H2/2025Update/HudsonValley2)
AMD Ryzen 9 7950X3D 4.20GHz, 1 CPU, 32 logical and 16 physical cores
.NET SDK 10.0.203
  [Host]     : .NET 8.0.26 (8.0.26, 8.0.2626.16921), X64 RyuJIT x86-64-v4
  Job-AOJIKS : .NET 8.0.26 (8.0.26, 8.0.2626.16921), X64 RyuJIT x86-64-v4
  Job-HBMQMI : .NET 9.0.15 (9.0.15, 9.0.1526.17522), X64 RyuJIT x86-64-v4
  Job-EPQKMY : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v4

Server=False  IterationCount=1  LaunchCount=50
RunStrategy=ColdStart  WarmupCount=0
Method Runtime Mean Error StdDev Ratio RatioSD Allocated Alloc Ratio
ConstructAndInitialize .NET 8.0 118.5 ms 1.28 ms 2.58 ms 1.00 0.03 155.5 KB 1.00
ConstructAndInitialize .NET 9.0 115.7 ms 1.01 ms 2.03 ms 0.98 0.03 107.6 KB 0.69
ConstructAndInitialize .NET 10.0 160.3 ms 1.27 ms 2.56 ms 1.35 0.04 203.73 KB 1.31

.NET 10.0.7 + AMD 7950x

// * Summary *

BenchmarkDotNet v0.15.8, Windows 11 (10.0.26200.8246/25H2/2025Update/HudsonValley2)
AMD Ryzen 9 7950X 4.50GHz, 1 CPU, 32 logical and 16 physical cores
.NET SDK 10.0.203
  [Host]     : .NET 8.0.26 (8.0.26, 8.0.2626.16921), X64 RyuJIT x86-64-v4
  Job-AOJIKS : .NET 8.0.26 (8.0.26, 8.0.2626.16921), X64 RyuJIT x86-64-v4
  Job-HBMQMI : .NET 9.0.15 (9.0.15, 9.0.1526.17522), X64 RyuJIT x86-64-v4
  Job-EPQKMY : .NET 10.0.7 (10.0.7, 10.0.726.21808), X64 RyuJIT x86-64-v4

Server=False  IterationCount=1  LaunchCount=50
RunStrategy=ColdStart  WarmupCount=0
Method Runtime Mean Error StdDev Median Ratio RatioSD Allocated Alloc Ratio
ConstructAndInitialize .NET 8.0 118.4 ms 2.71 ms 5.48 ms 115.9 ms 1.00 0.06 155.5 KB 1.00
ConstructAndInitialize .NET 9.0 116.1 ms 2.65 ms 5.36 ms 113.5 ms 0.98 0.06 155.65 KB 1.00
ConstructAndInitialize .NET 10.0 161.0 ms 3.49 ms 7.04 ms 156.1 ms 1.36 0.08 155.68 KB 1.00

Analysis

I'm not sure if the problem is limited to System.Reactive usage but in our case it's been affected the most.
Throughput performance in .net10 is on par with .net8 and .net9 in this benchmark so I think the issue only affects cold starts.

Activity

  1. added
    tenet-performance
    on May 2, 2026
  2. added
    untriaged
    on May 2, 2026
  3. added
    area-CodeGen-coreclr
    on May 2, 2026
  4. dotnet-policy-service commented on May 2, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  5. petevb commented on May 8, 2026

    @petevb

    @JulieLeeMSFT, @jakobbotsch can you take a look please? This blocks us moving from .NET 8 which is EOL Nov 10.

  6. removed
    untriaged
    on May 8, 2026
  7. added this to the 11.0.0 milestone on May 8, 2026
  8. JulieLeeMSFT commented on May 8, 2026

    @JulieLeeMSFT
    Member

    @EgorBo PTAL.

    @JulieLeeMSFT, @jakobbotsch can you take a look please? This blocks us moving from .NET 8 which is EOL Nov 10.

  9. petevb commented on May 15, 2026

    @petevb

    @EgorBo can you take a look please? This blocks us moving from .NET 8 which is EOL Nov 10.

  10. EgorBo commented on May 15, 2026

    @EgorBo
    Member

    @EgorBo can you take a look please? This blocks us moving from .NET 8 which is EOL Nov 10.

    Sure, I'm bisecting the problem

  11. EgorBo commented on May 16, 2026

    @EgorBo
    Member

    Note

    This comment was authored with the help of GitHub Copilot CLI (run by @EgorBo).

    I bisected this against every available 10.x SDK on Windows x64 (AMD 7950X) using the original BDN repro from this issue (ViewModelInitBench.ConstructAndInitialize, BDN ColdStart, LaunchCount=50). Each run pinned DOTNET_ROOT/PATH to one SDK so the system-wide install never participates. .NET 9.0.16 is the baseline.

    Cold-start results across SDKs

    SDK Runtime Mean (ms) Δ vs 9.0.16
    9.0.314 9.0.16 112.1 0.0
    10.0.100-preview.1 10.0.0-preview.1 112.3 +0.2
    10.0.100-preview.2 10.0.0-preview.2 123.4 +11.3
    10.0.100-preview.3 10.0.0-preview.3 123.2 +11.0
    10.0.100-preview.4 10.0.0-preview.4 126.9 +14.8
    10.0.100-preview.5 10.0.0-preview.5 139.0 +26.9
    10.0.100-preview.6 10.0.0-preview.6 149.8 +37.7
    10.0.100-preview.7 10.0.0-preview.7 134.9 +22.7
    10.0.100-rc.1 10.0.0-rc.1 132.3 +20.2
    10.0.100-rc.2 10.0.0-rc.2 132.8 +20.7
    10.0.100 10.0.0 128.6 +16.5
    10.0.101 10.0.1 129.4 +17.3
    10.0.102 10.0.2 133.1 +21.0
    10.0.103 10.0.3 129.7 +17.6
    10.0.200 10.0.4 156.7 +44.5 ⬆
    10.0.201 10.0.5 157.7 +45.6
    10.0.202 10.0.6 156.0 +43.9
    10.0.203 10.0.7 156.7 +44.5
    10.0.108 10.0.8 158.1 +46.0
    10.0.204 10.0.8 156.9 +44.8
    10.0.300 10.0.8 157.2 +45.1

    Where the regression happened

    Most of the gap accumulated during the preview cycle (a separate investigation), but the biggest single jump is in servicing:

    10.0.3 → 10.0.4: +27 ms in one release (129.7 → 156.7 ms). This single delta is bigger than any preview-cycle delta and accounts for ~60% of the total 10.0 regression vs 9.0. It is stable across 10.0.4 / 10.0.5 / 10.0.6 / 10.0.7 / 10.0.8 servicing patches, so it's clearly a code change that landed once and stuck.

    The v10.0.3..v10.0.4 window has 43 commits, of which 15 touch CoreCLR; none touch the JIT.

    Primary suspect

    #123520 "Fix regression caused by special marker type optimization" (backport of #123413), merged Jan 23 2026 to release/10.0.

    This PR rewrites MethodTableBuilder::LoadExactInterfaceMap (+113 lines) to handle correctness bugs in the earlier startup-perf optimization #120712 / #120459 ("Reduce types loaded on startup significantly", claimed "reduces startup time of small applications by as much as 20%", shipped in 10.0.3). #123520's own PR description acknowledges this:

    This regressed with the change to improve the performance of process startup. See PR #120712. That PR had several bugs which were noticed within days of 10.0.2 releasing.

    The fix is more conservative than necessary for our workload:

    • A new retry = true path causes LoadExactInterfaceMap to re-run with exact instantiations whenever the special-marker fast path can't be safely used.
    • A new EligibleForSpecialMarkerTypeUsage check falls through to loading the exact uninstantiated interface MT when generic args differ — which is exactly the shape of every Rx subscription in this repro (IObservable<ValueTuple<Bool, Int32, String, …>>, IObserver<…> with mixed type args).

    This matches the ETW profile I captured (MethodTableBuilder::BuildMethodTableThrowing, ClassLoader::LoadTypeHandleForTypeKey, and MethodTable::MethodDataObject::FillEntryDataForAncestor all became significantly hotter in 10.0.4+).

    Secondary suspect (smaller contribution)

    #124110 "Fix token memory ordering issue reading from the MethodDef and FieldDef token tables" (backport of #123557), merged Feb 10 2026.

    Replaces VolatileLoadWithoutBarrier → VolatileLoad in LookupMap::GetValueAt, called on every token→MethodDesc/FieldDesc/MethodTable lookup. The PR author explicitly flagged: "Low, the largest risk is a small performance regression." Likely accounts for a few ms of the 27.

  12. EgorBo commented on May 16, 2026

    @EgorBo
    Member

    cc @davidwrighton @jkotas

    Moving to VM area since there were no JIT changes between 10.0.3 and 10.0.4 runtimes (biggest offender)

  13. added and removed
    area-CodeGen-coreclr
    on May 16, 2026
  14. dotnet-policy-service commented on May 16, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @agocke
    See info in area-owners.md if you want to be subscribed.

  15. EgorBo commented on May 16, 2026

    @EgorBo
    Member

    Note

    AI-assisted (GitHub Copilot CLI, run by @EgorBo).

    Brief follow-up on the preview.1 → preview.2 step (+11 ms) — likely suspects in that window:

  16. EgorBo commented on May 16, 2026

    @EgorBo
    Member

    Actually, it can also be #123615 after a precise bisection.. (copilot claims it's native PGO)

  17. firenero commented on May 27, 2026

    @firenero
    Author

    @EgorBo @JulieLeeMSFT thanks for investigating the issue. I see a couple related PRs merged but it's not clear when we can expect it to be released? Looks like these fixes will be included in 10.0.10 but milestone for this ticket is set to 11.0.0. Also, if it's 10.0.10, is there an estimated release date for that version?

  18. EgorBo commented on Jun 2, 2026

    @EgorBo
    Member

    @EgorBo @JulieLeeMSFT thanks for investigating the issue. I see a couple related PRs merged but it's not clear when we can expect it to be released? Looks like these fixes will be included in 10.0.10 but milestone for this ticket is set to 11.0.0. Also, if it's 10.0.10, is there an estimated release date for that version?

    I am not entirely sure it will be fully mitigated by #128345 but I suspect it should be in June's patch, need to check the exact date.

  19. modified the milestones: 11.0.0, 10.0.x on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-VM-coreclrtenet-performance

Type

No type

Projects

  • Status
    No status

Relationships

None yet

Development

No branches or pull requests

Issue actions