Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Add support for non-generic IEnumerable, IList, ICollection#38307

Closed
layomia wants to merge 3 commits intodotnet:masterfrom
layomia:non-generic_collections
Closed

Add support for non-generic IEnumerable, IList, ICollection#38307
layomia wants to merge 3 commits intodotnet:masterfrom
layomia:non-generic_collections

Conversation

@layomia
Copy link
Copy Markdown
Contributor

@layomia layomia commented Jun 6, 2019

Partly addresses https://github.com/dotnet/corefx/issues/36643.

Benchmarks: dotnet/performance#547.

Method ElementCount Mean Error StdDev Median Gen 0 Gen 1 Gen 2 Allocated
DeserializeGenericList 2 550.7 ns 10.684 ns 10.493 ns 555.2 ns 0.0515 - - 216 B
DeserializeIEnumerable 2 1,586.2 ns 31.569 ns 73.791 ns 1,595.6 ns 0.1583 - - 664 B
DeserializeIList 2 1,565.6 ns 30.513 ns 44.725 ns 1,558.8 ns 0.1583 - - 664 B
DeserializeICollection 2 1,543.3 ns 28.938 ns 45.899 ns 1,540.2 ns 0.1583 - - 664 B
SerializeGenericList_ToUtf8Bytes 2 523.0 ns 10.527 ns 21.265 ns 525.8 ns 0.0553 - - 232 B
SerializeIList_ToUtf8Bytes 2 590.0 ns 11.848 ns 28.157 ns 584.1 ns 0.0553 - - 232 B
SerializeIEnumerable_ToUtf8Bytes 2 546.1 ns 6.353 ns 5.943 ns 545.2 ns 0.0553 - - 232 B
SerializeICollection_ToUtf8Bytes 2 575.6 ns 4.637 ns 4.111 ns 574.8 ns 0.0553 - - 232 B
DeserializeGenericList 50 6,577.9 ns 130.163 ns 121.755 ns 6,625.2 ns 0.8698 - - 3664 B
DeserializeIEnumerable 50 30,287.2 ns 591.428 ns 580.862 ns 30,383.1 ns 3.6011 0.0610 - 15184 B
DeserializeIList 50 30,452.5 ns 287.717 ns 269.131 ns 30,520.1 ns 3.6011 0.0610 - 15184 B
DeserializeICollection 50 30,592.4 ns 522.230 ns 488.495 ns 30,795.8 ns 3.6011 0.0610 - 15184 B
SerializeGenericList_ToUtf8Bytes 50 5,861.5 ns 101.192 ns 89.704 ns 5,876.9 ns 0.1678 - - 704 B
SerializeIList_ToUtf8Bytes 50 8,357.5 ns 190.401 ns 561.400 ns 8,366.6 ns 0.1678 - - 704 B
SerializeIEnumerable_ToUtf8Bytes 50 7,646.3 ns 46.657 ns 41.361 ns 7,626.8 ns 0.1678 - - 704 B
SerializeICollection_ToUtf8Bytes 50 8,039.4 ns 153.934 ns 171.097 ns 7,984.7 ns 0.1678 - - 704 B
DeserializeGenericList 100 13,310.7 ns 275.124 ns 643.093 ns 13,063.2 ns 1.7090 - - 7208 B
DeserializeIEnumerable 100 65,976.2 ns 1,314.053 ns 3,248.014 ns 64,810.4 ns 7.2021 - - 30328 B
DeserializeIList 100 61,431.8 ns 1,201.307 ns 1,123.703 ns 61,911.3 ns 7.2021 0.1221 - 30328 B
DeserializeICollection 100 61,920.1 ns 1,473.649 ns 1,513.329 ns 62,189.8 ns 7.2021 0.0610 - 30328 B
SerializeGenericList_ToUtf8Bytes 100 11,497.6 ns 227.366 ns 295.640 ns 11,507.6 ns 0.2747 - - 1200 B
SerializeIList_ToUtf8Bytes 100 15,675.2 ns 216.392 ns 191.826 ns 15,707.4 ns 0.2747 - - 1200 B
SerializeIEnumerable_ToUtf8Bytes 100 15,078.5 ns 249.513 ns 233.394 ns 15,182.4 ns 0.2747 - - 1200 B
SerializeICollection_ToUtf8Bytes 100 15,126.9 ns 145.512 ns 136.112 ns 15,150.1 ns 0.2747 - - 1200 B

Json.NET

No deserialization support for IEnumerable and ICollection

Method ElementCount Mean Error StdDev Median Gen 0 Gen 1 Gen 2 Allocated
DeserializeGenericList 2 21,603.1 ns 5,364.263 ns 15,647.808 ns 12,900.0 ns - - - 2.69 KB
DeserializeIList 2 847.2 ns 15.718 ns 14.702 ns 848.0 ns 0.6571 - - 2.69 KB
SerializeGenericList_ToString 2 567.1 ns 9.628 ns 9.006 ns 569.1 ns 0.3328 - - 1.36 KB
SerializeIList_ToString 2 556.7 ns 10.366 ns 9.189 ns 557.7 ns 0.3328 - - 1.36 KB
SerializeIEnumerable_ToString 2 558.2 ns 8.070 ns 7.549 ns 561.1 ns 0.3328 - - 1.36 KB
SerializeICollection_ToString 2 544.3 ns 10.343 ns 11.496 ns 545.5 ns 0.3328 - - 1.36 KB
DeserializeGenericList 50 6,503.7 ns 129.334 ns 181.308 ns 6,448.2 ns 1.3657 - - 5.59 KB
DeserializeIList 50 6,978.5 ns 73.368 ns 65.038 ns 6,979.7 ns 1.3657 - - 5.59 KB
SerializeGenericList_ToString 50 4,470.0 ns 69.800 ns 65.291 ns 4,461.9 ns 0.6943 - - 2.85 KB
SerializeIList_ToString 50 4,570.4 ns 69.667 ns 58.175 ns 4,592.5 ns 0.6943 - - 2.85 KB
SerializeIEnumerable_ToString 50 4,626.5 ns 119.268 ns 254.169 ns 4,540.5 ns 0.6943 - - 2.85 KB
SerializeICollection_ToString 50 4,462.8 ns 80.141 ns 74.964 ns 4,453.0 ns 0.6943 - - 2.85 KB
DeserializeGenericList 100 12,231.8 ns 241.116 ns 475.939 ns 12,086.9 ns 2.0905 - - 8.57 KB
DeserializeIList 100 15,465.8 ns 407.606 ns 1,149.660 ns 15,303.9 ns 2.0905 - - 8.57 KB
SerializeGenericList_ToString 100 49,678.3 ns 5,560.972 ns 15,684.820 ns 49,750.0 ns - - - 4.9 KB
SerializeIList_ToString 100 8,977.2 ns 191.709 ns 537.573 ns 8,891.2 ns 1.1902 - - 4.9 KB
SerializeIEnumerable_ToString 100 8,925.4 ns 226.102 ns 622.750 ns 8,636.3 ns 1.1902 - - 4.9 KB
SerializeICollection_ToString 100 8,508.9 ns 73.005 ns 64.717 ns 8,517.8 ns 1.1902 - - 4.9 KB

Hot-path perf diff

There seems to be an dependency update lag between the perf and corefx repos, so I'll run a hot-path (de)serialization perf diff later. I don't suspect there are any regressions.

@layomia layomia added this to the 3.0 milestone Jun 6, 2019
@layomia layomia self-assigned this Jun 6, 2019
Comment thread src/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs Outdated
Comment thread src/System.Text.Json/src/System/Text/Json/Serialization/JsonClassInfo.cs Outdated
Comment thread src/System.Text.Json/src/System/Text/Json/Serialization/JsonPropertyInfo.cs Outdated
@layomia layomia force-pushed the non-generic_collections branch from 4fecca0 to b7f8ca8 Compare June 10, 2019 13:16
@layomia
Copy link
Copy Markdown
Contributor Author

layomia commented Jun 10, 2019

Changes here have been merged in #38319.

@layomia layomia closed this Jun 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants