-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Switch System.IO usage with Microsoft.IO usage to reduce string allocations during scanning directory (and some other path manipulation too.) #6075
Comments
It is maybe not relevant here, but please be aware of past failed attempts: |
I was looking up the source of the package, it seems to only support Windows? |
Microsoft.IO.Redist brings some of the new .NET Core System.IO functionality to .NET Framework. As such it is Windows only. For a multi-targeted project like MSBuild, we should be able to use namespace |
Since NGEN seems to have been a problem in the past attempt, I'm going to link #6666. Treating the new dependency just like the other system stuff there should be enough to generate a good native image. |
Exit criteria & Estimate:
|
That will break everything running on Mono though. |
Yeah, I saw about Mono in the PR comments for the previous attempt. At the moment my condition for |
Status update: I have created a draft PR that replaces IO enumeration calls for the default implementation of IFileSystem. The experimental insertion uncovered that there is a difference in behavior between enumeration API from System.IO and Microsoft.IO. Measurements were done on my dev laptop for System.IO and Microsoft.IO enumeration (using ETW events).
So, here are two thoughts:
|
Thanks @AR-May. The bigger gains should be in memory in terms of gen 0 survival and allocated. That indirectly translates to perf gains which may be minimized slightly by 64 bit VS. |
Hmm, right, memory wins should also translate to less time in evaluation. I computed the gains in memory when I did initial investigation, you can see them here (numbers that you see above is a second iteration of measurements, computed for the current code from PR). Well, memory gains were there, but I have doubt it is a big part of these additional 20% of gain, i would be surprised if that is so. I am not really sure how memory gains translates to time gains though, but I do not expect them be that high... |
The second part of status update: the risks. Working on this issue we first broke the unit tests in msbuild repo and then broke >244 tests in the experimental insertion PR (required, optional & DDRITs, all of them). The reason is that similar API for enumeration seems to have different outputs in some cases. These cases were hit in unit tests and, more important, in experimental insertion tests. Even when we fix all the test above, without additional investigation the risks are high.
|
The failures of DDRITs and other tests were addressed. I verified that there is no difference in the API for enumeration. State: I fixed a problem & misleading errors. The PR is in review. One more problem was uncovered during the PR review: the code fails one of our sanity checks related to our projects' structure. This failure is actually not quite related to the changes, but rather the changes uncovered the existing problem with that. The milestone should not be affected by that, we have got a plan how to deal with that in the PR and upon that we will merge the PR. |
Fixes #6075 ### Context Microsoft.IO.Redist brings some of the new .NET Core System.IO functionality to .NET Framework. In particular, enumeration in Microsoft.IO was optimized comparing to System.IO: new enumeration API was added and old one was improved. We consider it is beneficial to switch default file system enumeration to the old API from Microsoft.IO.Redist. ### Changes Made - Added Microsoft.IO.Redist - Default file system enumeration uses Microsoft.IO instead of System.IO ### Testing Unit tests & DDRITs ### Notes We should be wary of possible regressions. There were differences in behavior, see `.NET Framework only` notes in [doc](https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.enumeratefiles?view=net-5.0). The change therefore is under change wave 17_0.
Child of #6034
CPS switch is here - https://devdiv.visualstudio.com/DevDiv/_git/CPS?path=%2Fsrc%2FMicrosoft.VisualStudio.ProjectSystem%2FUtilities%2FPathHelper.cs&version=GBmain&line=22&lineEnd=23&lineStartColumn=1&lineEndColumn=1&lineStyle=plain&_a=contents
Highlights of the switch
The text was updated successfully, but these errors were encountered: