Skip to content

Performance degradation on many tests #4009

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

Closed
timcassell opened this issue Nov 29, 2021 · 8 comments
Closed

Performance degradation on many tests #4009

timcassell opened this issue Nov 29, 2021 · 8 comments

Comments

@timcassell
Copy link

timcassell commented Nov 29, 2021

I've been noticing performance degradation when running many tests (thousands in my project) for a while. It's especially noticeable on my long-running tests, but the test times also show degradation on quick tests also.

I have setup and teardowns for every test.

At first I thought it was because I have objects pooling and the pool could be causing a leak and interfering with the performance, but I still see the same degradation with the pool disabled.

image

image

When I run all tests in a group, the last sub-group takes 1.4s. Then when I run just the last sub-group independently, it takes 480ms, nearly 1/3 of the time. The more tests I run at a time, the longer it takes the last test to complete. This is a big problem for me with over 3600 tests, half of them are long-running (the images are only showing the quick tests).

I was using NUnit 3.13.0, and I just updated to NUnit 3.13.2 and saw the same behavior on both versions.

Any ideas?

[Edit] I should add that my library is targeting netstandard2.0, and I'm running the tests in net472 and net5.0 (I see the same degradation in both runtimes).

@mikkelbu
Copy link
Member

@timcassell Do you see the same degradation when you run the tests using the NUnit console - https://github.com/nunit/nunit-console/releases/tag/v3.12 - and/or NUnitLite - see e.g. https://docs.nunit.org/articles/nunit/running-tests/NUnitLite-Runner.html

When you are running the tests in VS you are also depending on VS, VSTest, and the NUnit 3 Test Adapter, so the above suggestion is to determine where the problem is. Note that both the NUnit console and the NUnit 3 Test Adapter uses the NUnit engine.

@timcassell
Copy link
Author

timcassell commented Dec 2, 2021

@mikkelbu Interestingly, I got the opposite effect with the nunit3-console. Though I could only run the net472 tests with it, not net5.0.

nunit3-console ProtoPromiseTests.dll --where "namespace == ProtoPromiseTests.APIs"

SequenceTests duration="0.539729"
nunit3-console ProtoPromiseTests.dll --where "class = ProtoPromiseTests.APIs.SequenceTests"

SequenceTests duration="0.606604"

And I'm not sure if the nunit3-console executes the tests in the same order as the VS test runner (though I'm guessing it does if the output XML is any indication).

@lahma
Copy link
Contributor

lahma commented Jan 26, 2022

When someone says thousands of tests this might be the same problem I encountered with my large parametrized test suite of 86k tests, more information in the PR here #4034 . You examples use a specific filter so it shouldn't be a filtering issue, but it might be the load phase which I also tried to address.

@rprouse
Copy link
Member

rprouse commented Feb 21, 2023

I believe this is fixed with #4034, please reopen if I am wrong.

@OsirisTerje
Copy link
Member

@lahma Is this also fixed in main ? Do you have the PR for that?

@stevenaw
Copy link
Member

@OsirisTerje
I think I ported this in #4053
I may've set the milestone incorrectly there. On mobile at the moment and can't check too in-depth

@OsirisTerje
Copy link
Member

@stevenaw Thanks! That's cool! #4053 is in and correct :-)

@lahma
Copy link
Contributor

lahma commented Oct 29, 2023

Yes I can also confirm that the linked PR brought the intended changes to main too 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants