Skip to content
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

Proposal: Skip existence check for file cache if user specifies ignoremissingimports #10206

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

cgraig
Copy link

@cgraig cgraig commented Jun 4, 2024

Context

Parsing of large amounts of msbuild projects (thousands) can hit some performance issues while utilizing the evaluation APIs. These performance issues can be overcome with some changes, however, further improvements can be made in the existence path. If a consumer is utilizing the evaluation APIs and is already specifying IgnoreMissingImports then existence really shouldn't be necessary and instead falling back to I/O try/catch logic that already exists should be sufficient. These existence checks force a round trip to the OS every time resulting in unnecessary pinvoke paths which can play a role in performance degradation. Again this is for large amounts of projects and is really for diabolical cases.

Changes Made

If a consumer is specifying IgnoreMissingImports we should ignore existence checks to avoid the unnecessary pinvoke roundtrip to the filesystem. The user needs to opt into this behavior by specifying the MSBUILDSKIPEXISTENCECHECKFORCACHE env var. So this feature is behind two gates: need this env var + need to IgnoreMissingImports.

Testing

Anecdotally seeing 50% perf improvement with this change when run against larger number of projects.

Notes

@cgraig cgraig marked this pull request as ready for review October 23, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants