-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Performance optimization of FileSystem.CreateDirectory on windows #62860
Conversation
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsCloses #61954 Current state of implementation
|
Benchmark results .NET 6
Benchmark results .NET 7
Regression from .NET 6 😦 Benchmarks after this change
and my change regresses too |
src/libraries/Common/src/System/IO/FileSystem.DirectoryCreation.Windows.cs
Outdated
Show resolved
Hide resolved
…ecause it will be heap-allocated
I've done some benchmarks:
Usage of ReadOnlySpan.Slice instead of string.Substring
Style changes and only one Span usage
|
In my opinion, unfortunately, you can not optimize much more, because quite a lot of performance CreateDirectoryW is lost, which we can not influence. I am of course open to further suggestions. |
Thanks for your interest in contributing here, but I don't understand what it is you're actually improving. I see a lot of stylistic changes (which we ask not be made as part of the same PRs making perf / functional changes), but I see little to no changes that would positively impact performance (I see some that could theoretically help in some cases but similarly hurt in others, e.g. preinitializing a list to be able to store 8 elements). |
Yes, the bottleneck seems to be in I will start the branch again (without style changes) and see if I can do some micro optimization. One tweak I made is to not duplicate the AttributeInfo retrieval, which made little improvement for me after the benchmarks though 1. I would then apply this change. The preinitialization of the List of course only makes sense if we know in advance how many entries we will get. Footnotes
|
Thanks for your interest in improving performance. I'm going to close this until there's a demonstrable improvement. |
Thank you 👍🏼. |
Closes #61954
Current state of implementation