Allow specifying IndentCharacter and IndentSize when writing JSON#95292
Allow specifying IndentCharacter and IndentSize when writing JSON#95292eiriktsarpalis merged 29 commits intodotnet:mainfrom
Conversation
|
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
|
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsCloses #63882
|
...braries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.Caching.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializerOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.cs
Outdated
Show resolved
Hide resolved
eiriktsarpalis
left a comment
There was a problem hiding this comment.
This is adding logic to the JSON writer hot path, so we need to verify it doesn't introduce any unintentional performance regressions. Could you try running the benchmarks found in
comparing the current main with your PR branch. Instructions on how to do this can be found here.
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/OptionsTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs
Outdated
Show resolved
Hide resolved
....Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSourceGenerationOptionsTests.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Eirik Tsarpalis <[email protected]>
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterHelper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonWriterTests.cs
Show resolved
Hide resolved
eiriktsarpalis
left a comment
There was a problem hiding this comment.
Thanks, this is getting really close. Would it be possible to share updated benchmark numbers with the newer implementation?
New benchmarks resultssummary: better: 20, geomean: 1.090 worse: 31, geomean: 1.124 total diff: 51
I do not know how to interpret these results, as even Read-based and deserialization tests are impacted !?! |
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterOptions.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonWriterOptionsTests.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.cs
Outdated
Show resolved
Hide resolved
Benchmarks resultssummary: better: 17, geomean: 1.111 worse: 21, geomean: 1.089 total diff: 38
Still no clue how to interpret these results... |
src/libraries/System.Text.Json/src/System/Text/Json/Writer/JsonWriterOptions.cs
Outdated
Show resolved
Hide resolved
eiriktsarpalis
left a comment
There was a problem hiding this comment.
Thank you so much for your work @manandre!
Closes #63882