-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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] Move inline throw statements to ThrowHelper
#61746
[System.Text.Json] Move inline throw statements to ThrowHelper
#61746
Conversation
Tagging subscribers to this area: @dotnet/area-system-text-json Issue DetailsReplaces a number of occurrences of While .NET 6 codegen around exception throwing appears to have improved, I'm still seeing modest performance improvements in microbenchmarks, particularly around the Fix #59378.
|
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.TryGet.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.TryGet.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/ThrowHelper.cs
Outdated
Show resolved
Hide resolved
FWIW here are results comparing the BenchmarkDotNet=v0.13.1.1616-nightly, OS=Windows 10.0.22000
Intel Core i9-10900X CPU 3.70GHz, 1 CPU, 20 logical and 10 physical cores
.NET SDK=7.0.100-alpha.1.21566.20
[Host] : .NET 6.0.0 (6.0.21.52210), X64 RyuJIT
Job-FUQUAC : .NET 7.0.0 (42.42.42.42424), X64 RyuJIT
Job-YDOZOU : .NET 7.0.0 (42.42.42.42424), X64 RyuJIT
PowerPlanMode=00000000-0000-0000-0000-000000000000 Arguments=/p:DebugType=portable,-bl:benchmarkdotnet.binlog IterationTime=250.0000 ms
MaxIterationCount=20 MinIterationCount=15 WarmupCount=1
|
src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonElement.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Reader/Utf8JsonReader.TryGet.cs
Show resolved
Hide resolved
aae0d90
to
791ec4e
Compare
Replaces a number of occurrences of
throw ThrowHelper.GetException();
statements found in System.Text.Json withThrowHelper.ThrowException();
method calls.While .NET 6 codegen around exception throwing appears to have improved, I'm still seeing modest performance improvements in microbenchmarks, particularly around the
Utf8JsonReader.Get*()
methods, which are relatively small methods that inlinethrow
statements.Fix #59378.