-
Notifications
You must be signed in to change notification settings - Fork 80
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
Slow performance on discovery / running due to discovering TestReporters #317
Comments
What exactly did you do?
Is this specific to xunit? Or is that vstest problem in general, do you have some logs/code where I can see the iterating happening?
We have extension loading policy options in vstest, which by default look for all dlls based on naming convention plus some other based on folder location. There is also a strict explicit policy where you need to list in runsettings the exact dlls. We are trying to steer away from inspecting all possibly relevant dlls, because as you say it adds a lot of unnecessary overhead. |
Hi, The code that's causing the issue is: where the VsTestRunner iterates through every type in every dll in the path attempting to find reporters. The local change I made for testing passed in a set of explicit dlls into that method and used that to filter the dlls that would be enumerated. This only affects the VS / dotnet plugin (both when calling |
Also @kiwidev - could be kewl to have some ways to use wildcards, instead of having to list each one. So if you know your namespace (which should match the filenames, in this scenario) .. you can do |
Mentioned it also here, but this thread is more appropriate. FWIW in vstest we currently use a naming convention e.g. *TestAdapter.dll, and then an assembly level attribute also by convention (we know the shape of it, but the extension author defines it in their extension):
When found we inspect only those types for the desired type of extension, rather than inspecting all types. |
The introduction of parallel test discovery has definitely helped alleviate the issue, however it would be even better if this discovery process could be optimized. |
@nohwnd That attribute is marked as internal (and not in |
… due to discovering TestReporters
Once a test project has a number of files inside the output folder, then discovery of test reporters can add significant time onto both discovery and run phases inside Visual Studio. On a project with 100 dlls + regional versions (not a large number with modern libs), iterating through all of the dlls is adding on 1-3 seconds to each phase. This makes for a slow red-green-refactor cycle inside VS. (The current code iterates through every type inside every dll in the output folder).
I've done some local tests where I explicitly specified the list of dlls containing reporters (e.g.
xunit.runner.reporters.netcoreapp10.dll
) inside a runsettings file and this eliminated the overhead / reduced it to < 50ms. As an example, with a simple project this takes the "run test" process after changing a file (discovery and then run, excluding build) from 4 seconds to 1.5.Would the team be open to some sort of explicit flag like this inside runsettings or xunit config? Or is there a better way to do it?
Example (additional logging inserted by me, warm runs with fast NVMe disk, VS2022):
With config on:
The text was updated successfully, but these errors were encountered: