- Notifications
You must be signed in to change notification settings - Fork5.2k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ghost commentedJul 16, 2021
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 commentedJul 16, 2021
@uweigand, I would not be at all surprised if I got the endianness wrong here. Can you take a look? |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ghost commentedJul 20, 2021
Tagging subscribers to this area: @dotnet/area-system-runtime Issue Details
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_);}
|
stephentoub commentedJul 22, 2021
@tannergooding and/or@GrabYourPitchforks, could you help with a review here? Thanks. |
GrabYourPitchforks left a comment
There was a problem hiding this 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!
Uh oh!
There was an error while loading.Please reload this page.
DrewScoggins commentedJul 27, 2021
We are seeing this improvement in the lab as well. |
stephentoub commentedJul 27, 2021
Excellent :) |
DrewScoggins commentedJul 29, 2021
Also improved on Arm64.dotnet/perf-autofiling-issues#75 |
Uh oh!
There was an error while loading.Please reload this page.