Skip to content

Add benchmarks for (de)serializing non-generic IEnumerable, IList, ICollection#547

Merged
adamsitnik merged 3 commits intodotnet:masterfrom
layomia:non-generic_collections
Jul 18, 2019
Merged

Add benchmarks for (de)serializing non-generic IEnumerable, IList, ICollection#547
adamsitnik merged 3 commits intodotnet:masterfrom
layomia:non-generic_collections

Conversation

@layomia
Copy link
Copy Markdown
Contributor

@layomia layomia commented Jun 6, 2019

No description provided.


[BenchmarkCategory(Categories.CoreFX, Categories.JSON)]
[Benchmark]
public ICollection DeserializeICollection()
Copy link
Copy Markdown
Member

@adamsitnik adamsitnik Jun 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please share sample results? I wonder if there is any difference in the reported time between DeserializeIEnumerable, DeserializeIList and ICollection

[Benchmark]
public void DeserializeIEnumerable()
{
JsonSerializer.Parse<IEnumerable>(_jsonString);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return the IEnumerable just like the other tests.

@adamsitnik
Copy link
Copy Markdown
Member

@layomia similar to other stale PRs (#478, #530, #540, #589) I have cloned your fork, updated the code and pushed some fixes. I need to make sure that we don't regress it for 3.0. PTAL at my changes

BenchmarkDotNet=v0.11.3.1003-nightly, OS=Windows 10.0.18362
Intel Xeon CPU E5-1650 v4 3.60GHz, 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=3.0.100-preview7-012697
  [Host]     : .NET Core 3.0.0-preview7-27826-20 (CoreCLR 4.700.19.32603, CoreFX 4.700.19.32613), 64bit RyuJIT
  Job-QFFYAA : .NET Core 3.0.0-preview7-27826-20 (CoreCLR 4.700.19.32603, CoreFX 4.700.19.32613), 64bit RyuJIT

IterationTime=250.0000 ms  MaxIterationCount=20  MinIterationCount=15  
WarmupCount=1  
Type Method Mean Error StdDev Median Min Max Gen 0/1k Op Gen 1/1k Op Gen 2/1k Op Allocated Memory/Op
ReadJson<ArrayList> DeserializeFromString 66.64 us 0.7836 us 0.6543 us 66.53 us 65.56 us 67.57 us 4.3668 0.5459 - 35824 B
ReadJson<Hashtable> DeserializeFromString 94.35 us 1.6645 us 1.5569 us 94.84 us 91.72 us 96.78 us 7.1970 1.1364 - 56986 B
WriteJson<ArrayList> SerializeToString 19.31 us 0.2188 us 0.1939 us 19.35 us 18.96 us 19.62 us 0.7813 - - 6136 B
WriteJson<Hashtable> SerializeToString 53.41 us 0.7868 us 0.6975 us 53.61 us 52.37 us 54.39 us 3.8660 - - 31656 B
ReadJson<ArrayList> DeserializeFromUtf8Bytes 66.33 us 0.6545 us 0.5466 us 66.37 us 65.48 us 67.10 us 4.1322 0.5165 - 32840 B
ReadJson<Hashtable> DeserializeFromUtf8Bytes 93.47 us 1.1638 us 1.0886 us 93.63 us 91.03 us 94.99 us 6.1728 0.7716 - 51042 B
WriteJson<ArrayList> SerializeToUtf8Bytes 18.53 us 0.3608 us 0.3705 us 18.36 us 18.15 us 19.40 us 0.3642 - - 3176 B
WriteJson<Hashtable> SerializeToUtf8Bytes 52.53 us 0.8054 us 0.7533 us 52.53 us 50.93 us 53.70 us 3.1566 - - 25744 B
ReadJson<ArrayList> DeserializeFromStream 65.51 us 1.2683 us 1.3024 us 65.36 us 63.50 us 68.14 us 4.0584 0.5411 - 32912 B
ReadJson<Hashtable> DeserializeFromStream 92.51 us 1.4431 us 1.2793 us 92.52 us 90.31 us 94.70 us 6.3244 1.1161 - 51114 B
WriteJson<ArrayList> SerializeToStream 19.54 us 0.3153 us 0.2949 us 19.47 us 19.13 us 20.18 us - - - 192 B
WriteJson<Hashtable> SerializeToStream 53.56 us 0.8698 us 0.8136 us 53.54 us 52.21 us 54.87 us 2.4917 - - 19800 B

@adamsitnik adamsitnik merged commit 3d4bb67 into dotnet:master Jul 18, 2019
@layomia
Copy link
Copy Markdown
Contributor Author

layomia commented Jul 18, 2019

@adamsitnik LGTM, thanks!

@layomia layomia deleted the non-generic_collections branch July 18, 2019 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants