This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Add support for ISet<T>#38210
Closed
layomia wants to merge 4 commits intodotnet:masterfrom
Closed
Conversation
Contributor
|
On the benchmarks - Json.NET takes longer to deserialize 2 items than 50 or 100? |
Contributor
Author
Yes, even on repeated runs. I’m looking into why. First guess is cached reflection. |
watfordgnf
reviewed
Jun 4, 2019
Looking at the Error/StdDev, that test looks noisy. You want higher warmup count probably. |
Contributor
Author
|
Changes here have been merged in #38319. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The approach is to treat it like HashSet, similar to how we treat
IDictionary<string, TValue>andIReadOnlyDictionary<string, TValue>asDictionary<string, TValue>.Perf
We might see some perf gain by writing a special-case converter for
ISet<T>.This will also help mitigate the limitation on (de)serializingISet<ISet<T>>(and higher degrees ofISet<T>nesting) that I describe in this PR.For now, I'd rather spend the time on getting this and other collections through (https://github.com/dotnet/corefx/issues/36643), and circle back during/following testing/validation.
ISet<T>(de)serializationThe benchmarks are being added to the perf repo: dotnet/performance#540.
Json.Net
Hot-path (de)serialization scenarios
Benchmarks live in the perf repo.
No regressions: hot-path benchmark results.zip
UPDATE
The limitation on (de)serializing
ISet<ISet<T>>is fixed by using a runtime property type ofHashSet<TDeclaredPropertyOfElement>instead ofHashSet<TRuntimePropertyOfElement>forISet<TDeclaredPropertyOfElement>