Add JSON benchmarks for missing-property and case-insensitive#1322
Add JSON benchmarks for missing-property and case-insensitive#1322billwert merged 2 commits intodotnet:masterfrom
Conversation
|
|
||
| [BenchmarkCategory(Categories.Libraries, Categories.JSON)] | ||
| [Benchmark] | ||
| public T DeserializeMissing() => JsonSerializer.Deserialize<T>(_serializedCamelCased, _optionsBaseline); |
There was a problem hiding this comment.
Can you rename this? The current name took going to your original issue for me to understand.
| public T DeserializeMissing() => JsonSerializer.Deserialize<T>(_serializedCamelCased, _optionsBaseline); | |
| public T DeserializeWithMissingProperties() => JsonSerializer.Deserialize<T>(_serializedCamelCased, _optionsBaseline); |
May also be worth a comment to make it clear that the properties will be "missing" because we're not using the case insensitive option.
There was a problem hiding this comment.
Hmm one issue with names is that the results comparer truncates at 80 chars, so I've been trying to keep names small otherwise it may not be possible to distinguish between tests in the output.
However I didn't do a good job at that. It looks like System.Text.Json.Serialization.Tests.ReadMissingAndCaseInsensitive<Location>. is already at 77 characters leaving only 3 characters which currently is not even enough to distinguish between the 4 tests I added.
We could fix that issue with the results comparer, or I could simplify the class name and remove "DeserializeWith" but that still doesn't leave enough room to add "Properties".
There was a problem hiding this comment.
We should fix that in results comparer. @adamsitnik I assume this was a "nice output" choice and not something technical?
Our actual reporting backend does does not truncate these names (@DrewScoggins to correct me). I'm in favor of descriptive names so we should do what we need to in order to make that possible.
There was a problem hiding this comment.
Made some renames and added comments.
billwert
left a comment
There was a problem hiding this comment.
One change I'd like and then LGTM.
|
Thanks @steveharter! LGTM. We'll sort out the comparison tool separately. |
…#1322) * Add JSON benchmarks for missing and case-insensitive * Rename tests
…#1322) * Add JSON benchmarks for missing and case-insensitive * Rename tests
Adds new benchmarks to track changes made in dotnet/runtime#35848
Verifies ~2x perf improvement on the missing-property and case-insensitive scenarios.
Before changes from the runtime PR linked above:
After: