daveoftheparty / speedy-moq

Generate boilerplate code for Moq in C#
MIT License
1 stars 0 forks source link

perf: reduce .csproj filesystem lookups #14

Closed daveoftheparty closed 3 years ago

daveoftheparty commented 3 years ago

The other thing, in this log there is a 108 references for method GetCsProjFromCsFile is looking for a .csproj related to file csrcdaveofthepartyboiler-moqserverUnitTests.FeaturesMoqItAll.cs as I was typing changes in the document.

MoqItAll.log.txt

daveoftheparty commented 3 years ago

I looked through this a bit and it should be an easy fix. In InterfaceStore.GetCsProjFromCsFile() after we do the string replace on file:/// and before we perform the log statement, check a new dict<string, string> _csProjByIncomingFileName to see if the csproj has already been resolved. If so, bail out.

If not, add the new item to the dictionary before returning from the method. Because of file access on disk, this isn't easily unit testable, but you should be able to reproduce the multiple .csproj resolution lookups by watching the logs in an extension host to see what the bug is, fix it, and try to reproduce and watch the statements go away, and/or debug the server to see the early return from the method.