Skip to content

Severe degradation of JsonNode.Parse in net 7 ? #78966

Description

@MichaelLogutov

Hello.
We've faced severe degradation of our .net logs parser after switching from net 6 to net 7.
After some digging around with perfoкmance profiler I found pretty strange issue that I've isolated in Benchmark.NET code:

[SimpleJob(RuntimeMoniker.Net60, baseline: true)]
[SimpleJob(RuntimeMoniker.Net70)]
public class SystemTextJsonBenchmark
{
    [Benchmark]
    public void GetItemByIndexer() => JsonNode.Parse("{ \"value\": \"aaa\" }");
}

Which on my machine produces:

BenchmarkDotNet=v0.13.2, OS=Windows 11 (10.0.22000.1281/21H2)
11th Gen Intel Core i7-11800H 2.30GHz, 1 CPU, 16 logical and 8 physical cores
.NET SDK=7.0.100
  [Host]   : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2
  .NET 6.0 : .NET 6.0.11 (6.0.1122.52304), X64 RyuJIT AVX2
  .NET 7.0 : .NET 7.0.0 (7.0.22.51805), X64 RyuJIT AVX2


|           Method |      Job |  Runtime |     Mean |   Error |  StdDev | Ratio | RatioSD |
|----------------- |--------- |--------- |---------:|--------:|--------:|------:|--------:|
| GetItemByIndexer | .NET 6.0 | .NET 6.0 | 267.5 ns | 2.13 ns | 1.99 ns |  1.00 |    0.00 |
| GetItemByIndexer | .NET 7.0 | .NET 7.0 | 546.2 ns | 5.17 ns | 4.32 ns |  2.04 |    0.02 |

// * Hints *
Outliers
  SystemTextJsonBenchmark.GetItemByIndexer: .NET 7.0 -> 2 outliers were removed (560.97 ns, 562.93 ns)

Am I doing something wrong or missing something?

Here BenchmarkSandbox project

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions