Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

.NET 8 Update(6): CollectionsMarshal for ListFormatter#1732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
AArnott merged 4 commits intoMessagePack-CSharp:developfrompCYSl5EDgo:net8-cm
Jan 14, 2024

Conversation

@pCYSl5EDgo
Copy link
Contributor

List<T> for loop is slower thanSpan<T> for loop.
CollectionsMarshal.AsSpan convertsList<T> toSpan<T>
CollectionsMarshal.SetCount can be used for deserialize.

@pCYSl5EDgopCYSl5EDgo mentioned this pull requestJan 11, 2024
14 tasks
@pCYSl5EDgopCYSl5EDgo changed the title.Net 8 Update: CollectionsMarshal for ListFormatter.Net 8 Update(6): CollectionsMarshal for ListFormatterJan 11, 2024
Copy link
Collaborator

@AArnottAArnott left a comment

Choose a reason for hiding this comment

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

Wow. Did you happen to measure perf impact of this change?

@pCYSl5EDgo
Copy link
ContributorAuthor

pCYSl5EDgo commentedJan 13, 2024
edited
Loading

The below benchmarks were done without Dynamic PGO.
With Dynamic PGO, there was no difference between new formatter and old formatter.

List<byte>

BenchmarkDotNet v0.13.12, Windows 11 (10.0.22621.3007/22H2/2022Update/SunValley2)Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores.NET SDK 8.0.101  [Host]     : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2  DefaultJob : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2
MethodSizeMeanErrorStdDev
SerializeNew173.66 ns1.510 ns1.615 ns
SerializeOld176.72 ns1.452 ns1.728 ns
DeserializeNew189.63 ns1.852 ns2.535 ns
DeserializeOld190.21 ns1.846 ns4.665 ns
SerializeNew64257.25 ns5.140 ns5.279 ns
SerializeOld64258.83 ns4.092 ns5.025 ns
DeserializeNew64441.35 ns8.431 ns7.474 ns
DeserializeOld64481.55 ns7.090 ns6.286 ns
SerializeNew10243,420.87 ns66.383 ns71.029 ns
SerializeOld10243,415.81 ns13.653 ns11.401 ns
DeserializeNew10249,625.97 ns191.207 ns255.256 ns
DeserializeOld102410,175.56 ns203.576 ns217.824 ns
SerializeNew16777216122,029,780.00 ns1,344,153.681 ns1,257,322.187 ns
SerializeOld16777216131,873,157.69 ns2,493,291.890 ns3,412,846.081 ns
DeserializeNew16777216160,013,514.81 ns3,050,381.441 ns4,276,208.758 ns
DeserializeOld16777216167,149,218.84 ns3,336,039.530 ns4,219,021.850 ns

List<Matrix4x4>

BenchmarkDotNet v0.13.12, Windows 11 (10.0.22621.3007/22H2/2022Update/SunValley2)Intel Core i7-8750H CPU 2.20GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores.NET SDK 8.0.101  [Host]     : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2  DefaultJob : .NET 8.0.1 (8.0.123.58001), X64 RyuJIT AVX2
MethodSizeMeanErrorStdDev
SerializeNew1142.7 ns2.87 ns3.31 ns
SerializeOld1141.5 ns2.56 ns4.20 ns
DeserializeNew1220.5 ns4.03 ns5.51 ns
DeserializeOld1218.0 ns3.89 ns3.64 ns
SerializeNew644,730.6 ns68.85 ns57.50 ns
SerializeOld644,931.7 ns98.49 ns209.89 ns
DeserializeNew648,431.1 ns163.43 ns194.56 ns
DeserializeOld648,365.5 ns146.44 ns129.81 ns
SerializeNew1024149,412.6 ns2,915.70 ns4,364.08 ns
SerializeOld1024142,725.7 ns2,752.63 ns3,276.81 ns
DeserializeNew1024142,506.2 ns2,848.95 ns5,064.01 ns
DeserializeOld1024145,993.7 ns2,861.05 ns3,916.24 ns
SerializeNew167772161,588,265,229.5 ns38,374,748.24 ns105,695,201.32 ns
SerializeOld167772161,502,806,044.9 ns28,744,116.00 ns69,420,270.85 ns
DeserializeNew167772162,413,118,764.5 ns46,612,636.71 ns71,182,419.37 ns
DeserializeOld167772162,586,872,945.1 ns51,537,327.26 ns126,421,942.00 ns

@pCYSl5EDgo
Copy link
ContributorAuthor

pCYSl5EDgo commentedJan 13, 2024
edited
Loading

For smaller value types,Serialize of this PR is more performant than original one.
But for bigger value typesSerialize of this PR is slower than original one.

Deserialize of this PR is in most cases better than original.

Considering the above facts, let's revert the change forSerialize.

AArnott reacted with thumbs up emoji

@AArnottAArnott added this to thev2.6 milestoneJan 14, 2024
@AArnottAArnott merged commitbed1f44 intoMessagePack-CSharp:developJan 14, 2024
@pCYSl5EDgopCYSl5EDgo deleted the net8-cm branchJanuary 14, 2024 02:38
@pCYSl5EDgopCYSl5EDgo changed the title.Net 8 Update(6): CollectionsMarshal for ListFormatter.NET 8 Update(6): CollectionsMarshal for ListFormatterJan 21, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@AArnottAArnottAArnott approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

v3.0

Development

Successfully merging this pull request may close these issues.

2 participants

@pCYSl5EDgo@AArnott

[8]ページ先頭

©2009-2025 Movatter.jp