-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[StaticWebAssets] Improve globbing match performance #44159
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your PR, @javiercn. |
d5e70cd to
2989be9
Compare
2989be9 to
63d46de
Compare
4ab1292 to
f9901f5
Compare
18667d3 to
2ecffdf
Compare
cc17e82 to
cbef77d
Compare
968cdac to
5f24b5c
Compare
| { | ||
| // Token was embedded, so add it to the dictionary. | ||
| dictionary[part.Name] = part.Value; | ||
| dictionary[part.Name.ToString()] = part.Value.ToString(); |
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.
These are going to end up as strings, so it's ok to stringify here.
| Parallel.For( | ||
| 0, | ||
| CandidateAssets.Length, | ||
| () => new ParallelWorker( | ||
| endpoints, | ||
| new List<StaticWebAssetEndpoint>(), | ||
| CandidateAssets, | ||
| existingEndpointsByAssetFile, | ||
| Log, | ||
| contentTypeProvider, | ||
| _assetFileDetails, | ||
| TestLengthResolver, | ||
| TestLastWriteResolver), | ||
| static (i, loop, state) => state.Process(i, loop), | ||
| static worker => worker.Finally()); |
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.
This is cleaning up the implementation to avoid excessive locking by storing the intermediate results into a local list for each worker and saving them to the final collection at the end of processing.
b5a6c66 to
377bdd9
Compare
* Removes the usage of Microsoft.Extensions.FileSystemGlobbing in favor of a custom implementation optimized for our scenarios. * Improves the parallelism in DefineStaticWebAssetEndpoints. * Spanifies the string manipulation logic.
377bdd9 to
199c9bf
Compare
MackinnonBuck
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.
Awesome!
* Removes the usage of Microsoft.Extensions.FileSystemGlobbing in favor of a custom implementation optimized for our scenarios. * Improves the parallelism in DefineStaticWebAssetEndpoints. * Spanifies the string manipulation logic.
* Removes the usage of Microsoft.Extensions.FileSystemGlobbing in favor of a custom implementation optimized for our scenarios. * Improves the parallelism in DefineStaticWebAssetEndpoints. * Spanifies the string manipulation logic.
~.6s savings
Before
After