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

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

Closed
MichaelLogutov opened this issue Nov 29, 2022 · 5 comments
Closed

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

MichaelLogutov opened this issue Nov 29, 2022 · 5 comments
Labels

Comments

@MichaelLogutov
Copy link

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

@MichaelLogutov MichaelLogutov added the tenet-performance Performance related issue label Nov 29, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Nov 29, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Nov 29, 2022
@ghost
Copy link

ghost commented Nov 29, 2022

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

Issue Details

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

Author: MichaelLogutov
Assignees: -
Labels:

tenet-performance, area-CodeGen-coreclr

Milestone: -

@stephentoub
Copy link
Member

I've not tried the benchmark, but I suspect this is a duplicate of #78089, which was fixed in main by #78130 and ported to release/7.0 in #78147, such that a fix should be in the next servicing release.

@MichaelLogutov
Copy link
Author

Yeah, looks like it. Thanks.

@jkotas jkotas added area-System.Text.Json and removed area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Nov 29, 2022
@ghost
Copy link

ghost commented Nov 29, 2022

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

Issue Details

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

Author: MichaelLogutov
Assignees: -
Labels:

area-System.Text.Json, tenet-performance, area-CodeGen-coreclr, untriaged

Milestone: -

@eiriktsarpalis
Copy link
Member

I tried your benchmark on the latest .NET 7, can confirm that it's a duplicate of #78089.

@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Nov 29, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Dec 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants