-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
System.Text.Json source generators are not improving deserialize performance #82626
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsI've been attempting to apply some of the examples in the blog post https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/ However, I'm not seeing any performance improvements. In fact the source generator tests are always marginally slower than using SystemTextJson without source generators. Have a made a code error or have I mistaken expected performance improvement of using source generators for deserializing json string data? Below is sample benchmarks and code to replicate: BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22621.1265/22H2/2022Update/SunValley2)
SourceGenTest.csproj:
Program.cs:
|
source gen only improves serialization and trimmability of the app (since it doesn't use reflection). What article is referring to is likely fast-path and that is serialization only feature for now. |
Duplicate of #55043 |
I'm closing this as duplicate. Please respond in the other issue. |
I've been attempting to apply some of the examples in the blog post https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/
However, I'm not seeing any performance improvements. In fact the source generator tests are always marginally slower than using SystemTextJson without source generators.
Have a made a code error or have I mistaken expected performance improvement of using source generators for deserializing json string data?
Below is sample benchmarks and code to replicate:
BenchmarkDotNet=v0.13.5, OS=Windows 11 (10.0.22621.1265/22H2/2022Update/SunValley2)
12th Gen Intel Core i9-12900H, 1 CPU, 20 logical and 14 physical cores
.NET SDK=7.0.103
[Host] : .NET 7.0.3 (7.0.323.6910), X64 RyuJIT AVX2
DefaultJob : .NET 7.0.3 (7.0.323.6910), X64 RyuJIT AVX2
SourceGenTest.csproj:
Program.cs:
The text was updated successfully, but these errors were encountered: