Skip to content

Improve Etag ToString performance for DefaultFormat#22702

Merged
pakrym merged 1 commit intoAzure:mainfrom
johnthcall:EtagToString
Jul 19, 2021
Merged

Improve Etag ToString performance for DefaultFormat#22702
pakrym merged 1 commit intoAzure:mainfrom
johnthcall:EtagToString

Conversation

@johnthcall
Copy link
Copy Markdown
Member

Noticed that ETag ToString was calculating IsValidQuotedFormat even when using default format. Moves the calculation inline to improve performance for default formatting.
The below is a benchmark of ToString() on a Etag with value "test1"

Method Job Runtime Mean Error StdDev Ratio RatioSD
Before .NET 4.7.2 .NET 4.7.2 32.601 ns 0.7547 ns 2.2251 ns 1.00 0.00
Before .NET Core 5.0 .NET Core 5.0 18.484 ns 0.4553 ns 0.8210 ns 0.56 0.04
After .NET 4.7.2 .NET 4.7.2 7.577 ns 0.2393 ns 0.4723 ns 1.00 0.00
After .NET Core 5.0 .NET Core 5.0 7.268 ns 0.2279 ns 0.5505 ns 0.96 0.09

@ghost ghost added the Azure.Core label Jul 16, 2021
@pakrym pakrym requested a review from christothes July 19, 2021 16:03
@pakrym pakrym merged commit 2f289b1 into Azure:main Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants