- JsonDefaultArrayConverter<>
- Single-dimentional arrays
- JsonListOfTConverter<>
- List
- Types deriving from List
- JsonDictionaryOfStringTValueConverter<,>
- Dictionary<string, TValue>
- Types deriving from Dictionary
This file contains 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
private static void HandleStartObject(JsonSerializerOptions options, ref ReadStack state) | |
{ | |
Debug.Assert(!state.Current.IsProcessingDictionary()); | |
if (state.Current.IsProcessingEnumerable()) | |
{ | |
// A nested object within an enumerable. | |
Type objType = state.Current.GetElementType(); | |
state.Push(); | |
state.Current.Initialize(objType, options); |
This file contains 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
private static void HandleStartDictionary(JsonSerializerOptions options, ref ReadStack state) | |
{ | |
Debug.Assert(!state.Current.IsProcessingEnumerable()); | |
JsonPropertyInfo jsonPropertyInfo = state.Current.JsonPropertyInfo; | |
if (jsonPropertyInfo == null) | |
{ | |
jsonPropertyInfo = state.Current.JsonClassInfo.CreateRootProperty(options); | |
} |
Some performance notes.
- There's no significant performance impact on hot path (de)serialization i.e. primitives, objects, and enumerables.
- There's a little (~4.6% avg.) regression for deserializing
Dictionary
,IDictionary
, andIReadOnlyDictionary
. This is due to some necessary if-checks introduced in shared code-paths between non-immutable dicts and immutable dicts. Splitting their code-paths entirely might mitigate this, but is beyond the scope for preview 6. This will be targeted in preview 7. - We might be able to improve the performance of (de)serializing
ImmutableDicitonary
,IImmutableDictionary
, andImmutableSortedDictionay
by using IL emit to generate high performanceCreateRange
methods.
These benchmarks live in the perf repo.
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
NewerOlder