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

Improve Guid parsing performance for "D", "N", "B", and "P"#55792

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
stephentoub merged 2 commits intodotnet:mainfromstephentoub:guidparse
Jul 22, 2021

Conversation

@stephentoub
Copy link
Member

@stephentoubstephentoub commentedJul 16, 2021
edited
Loading

MethodToolchainMeanErrorStdDevRatio
D\main\corerun.exe69.87 ns0.644 ns0.538 ns1.00
D\pr\corerun.exe38.21 ns0.097 ns0.086 ns0.55
N\main\corerun.exe58.43 ns0.838 ns0.700 ns1.00
N\pr\corerun.exe37.97 ns0.207 ns0.173 ns0.65
B\main\corerun.exe69.52 ns0.337 ns0.281 ns1.00
B\pr\corerun.exe39.20 ns0.190 ns0.169 ns0.56
P\main\corerun.exe69.50 ns0.260 ns0.243 ns1.00
P\pr\corerun.exe39.92 ns0.139 ns0.116 ns0.57
InvalidD\main\corerun.exe73.47 ns0.656 ns0.614 ns1.00
InvalidD\pr\corerun.exe42.47 ns0.142 ns0.133 ns0.58
WeirdD\main\corerun.exe68.45 ns0.214 ns0.190 ns1.00
WeirdD\pr\corerun.exe102.44 ns0.643 ns0.537 ns1.50
usingBenchmarkDotNet.Attributes;usingBenchmarkDotNet.Running;usingSystem;[MemoryDiagnoser]publicclassProgram{publicstaticvoidMain(string[]args)=>BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);privatestring_d,_b,_p,_n;privatestring_invalidD;privatestring_weirdD;[GlobalSetup]publicvoidSetup(){Guidg=Guid.NewGuid();_d=g.ToString("D");_b=g.ToString("B");_p=g.ToString("P");_n=g.ToString("N");_invalidD=_d[..^1]+"Z";_weirdD="+"+_d[1..];}[Benchmark]publicboolD()=>Guid.TryParseExact(_d,"D",out_);[Benchmark]publicboolN()=>Guid.TryParseExact(_n,"N",out_);[Benchmark]publicboolB()=>Guid.TryParseExact(_b,"B",out_);[Benchmark]publicboolP()=>Guid.TryParseExact(_p,"P",out_);[Benchmark]publicboolInvalidD()=>Guid.TryParseExact(_invalidD,"D",out_);[Benchmark]publicboolWeirdD()=>Guid.TryParseExact(_weirdD,"D",out_);}

techiedesu, EgorBo, and pentp reacted with thumbs up emojipentp reacted with hooray emoji
@ghost
Copy link

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly onearea label.

@stephentoub
Copy link
MemberAuthor

@uweigand, I would not be at all surprised if I got the endianness wrong here. Can you take a look?

@ghost
Copy link

Tagging subscribers to this area: @dotnet/area-system-runtime
See info inarea-owners.md if you want to be subscribed.

Issue Details
MethodToolchainMeanErrorStdDevRatio
D\main\corerun.exe69.87 ns0.644 ns0.538 ns1.00
D\pr\corerun.exe38.21 ns0.097 ns0.086 ns0.55
N\main\corerun.exe58.43 ns0.838 ns0.700 ns1.00
N\pr\corerun.exe37.97 ns0.207 ns0.173 ns0.65
B\main\corerun.exe69.52 ns0.337 ns0.281 ns1.00
B\pr\corerun.exe39.20 ns0.190 ns0.169 ns0.56
P\main\corerun.exe69.50 ns0.260 ns0.243 ns1.00
P\pr\corerun.exe39.92 ns0.139 ns0.116 ns0.57
InvalidD\main\corerun.exe73.47 ns0.656 ns0.614 ns1.00
InvalidD\pr\corerun.exe42.47 ns0.142 ns0.133 ns0.58
WeirdD\main\corerun.exe68.45 ns0.214 ns0.190 ns1.00
WeirdD\pr\corerun.exe102.44 ns0.643 ns0.537 ns1.50
usingBenchmarkDotNet.Attributes;usingBenchmarkDotNet.Running;usingSystem;[MemoryDiagnoser]publicclassProgram{publicstaticvoidMain(string[]args)=>BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);privatestring_d,_b,_p,_n;privatestring_invalidD;privatestring_weirdD;[GlobalSetup]publicvoidSetup(){Guidg=Guid.NewGuid();_d=g.ToString("D");_b=g.ToString("B");_p=g.ToString("P");_n=g.ToString("N");_invalidD=_d[..^1]+"Z";_weirdD="+"+_d[1..];}[Benchmark]publicboolD()=>Guid.TryParseExact(_d,"D",out_);[Benchmark]publicboolN()=>Guid.TryParseExact(_n,"N",out_);[Benchmark]publicboolB()=>Guid.TryParseExact(_b,"B",out_);[Benchmark]publicboolP()=>Guid.TryParseExact(_p,"P",out_);[Benchmark]publicboolInvalidD()=>Guid.TryParseExact(_invalidD,"D",out_);[Benchmark]publicboolWeirdD()=>Guid.TryParseExact(_weirdD,"D",out_);}
Author:stephentoub
Assignees:-
Labels:

area-System.Runtime

Milestone:-

@stephentoub
Copy link
MemberAuthor

@tannergooding and/or@GrabYourPitchforks, could you help with a review here? Thanks.

Copy link
Member

@GrabYourPitchforksGrabYourPitchforks left a comment

Choose a reason for hiding this comment

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

Left a comment with potential for even further optimization, but the logic LGTM!

@stephentoubstephentoub merged commit676353c intodotnet:mainJul 22, 2021
@stephentoubstephentoub deleted the guidparse branchJuly 22, 2021 18:12
@DrewScoggins
Copy link
Member

We are seeing this improvement in the lab as well.

dotnet/perf-autofiling-issues#27

@stephentoub
Copy link
MemberAuthor

Excellent :)

@DrewScoggins
Copy link
Member

Also improved on Arm64.dotnet/perf-autofiling-issues#75

@ghostghost locked asresolvedand limited conversation to collaboratorsAug 28, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@GrabYourPitchforksGrabYourPitchforksGrabYourPitchforks approved these changes

+3 more reviewers

@jcdickinsonjcdickinsonjcdickinson left review comments

@uweiganduweiganduweigand left review comments

@hopperplhopperplhopperpl left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@stephentoub@DrewScoggins@jcdickinson@GrabYourPitchforks@uweigand@hopperpl

[8]ページ先頭

©2009-2025 Movatter.jp