Performance regression for .NET 9.0 / .NET 10.0 vs. .NET 8.0

Open
#118,909 26 comments 0 reactions 1 assignee View on GitHub

@AndyAyersMS is already working on this.

Since Sep 2, 2025.

Assessment

This issue has not been assessed yet.

Description

area-CodeGen-coreclr Priority:2 tenet-performance
Description

During benchmarking, we found that there is a significant difference between the performance of our project (RavenDB) between .NET 8.0 and .NET 9.0 or .NET 10.0.

Our results:

v7.1 (.net 8.0)
[OVERALL], RunTime(ms), 50225
[OVERALL], Throughput(ops/sec), 19910.40318566451

v7.1 (.net 9.0)
[OVERALL], RunTime(ms), 99615
[OVERALL], Throughput(ops/sec), 10038.648797871807

That is close to 50%(!) regression in our tests.

We were able to reproduce a similar regression in a much smaller benchmark, where we are observing roughly 10% performance regression between 8.0 and 9.0 (10.0 is a bit better than 9.0, it is still slower than 8.0).

Repro code here: https://gist.github.com/ayende/e94d9ad6e8bba41a36d33ffb9e6de2ad

Configuration
  • All tests were run on Windows
  • dotnet versions tests:
> dotnet --list-sdks
8.0.413 [C:\Program Files\dotnet\sdk]
9.0.304 [C:\Program Files\dotnet\sdk]
10.0.100-preview.6.25358.103 [C:\Program Files\dotnet\sdk]
Regression?

Significant performance regression

  • .NET 8.0 - 955ms - 995ms tested
  • .NET 9.0 - 1103ms - 1132ms tested

Full results:

PS C:\Work\tryout>  .\bin\Release\net8.0\ConsoleApp1.exe
955
PS C:\Work\tryout>  .\bin\Release\net8.0\ConsoleApp1.exe
989
PS C:\Work\tryout>  .\bin\Release\net8.0\ConsoleApp1.exe
995
PS C:\Work\tryout>  .\bin\Release\net9.0\ConsoleApp1.exe
1103
PS C:\Work\tryout>  .\bin\Release\net9.0\ConsoleApp1.exe
1119
PS C:\Work\tryout>  .\bin\Release\net9.0\ConsoleApp1.exe
1132
Data

Here is the profiling output comparing those two versions.
Note: Sparrow.Json.JsonOperationContext.ReadObjectInternal(Object, String, UsageMode, IBlittableDocumentModifier)

  • .NET 8.0 is 2,201 ms under profiler
  • .NET 9.0 is 2,847 ms under profiler
Image
Repro code

https://gist.github.com/ayende/e94d9ad6e8bba41a36d33ffb9e6de2ad

I run the build using dotnet build -c Release and change the <TargetFramework>net9.0</TargetFramework> in the .csproj from net8.0 to net9.0 to test the different frameworks.

@redknightlois @EgorBo

Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/runtime

All issues in dotnet/runtime

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.