Issafalcon / neotest-dotnet

Neotest adapter for dotnet
MIT License
71 stars 26 forks source link

Poor performance #93

Closed Anakael closed 6 months ago

Anakael commented 6 months ago

I have around 800 tests in my working project. After I call :TestSummary in one test class, my CPU fully consumed by many .NET HOSTs and all system is freezing.

B3RR10 commented 6 months ago

I'm having the same problem. Not only the CPU but also the RAM is consumed completely.

I'm using xUnit, and for me, it happens when I execute the nearest test, without opening the test summary.

Issafalcon commented 6 months ago

@Anakael / @B3RR10 - Could you add some more detail? Specifically:

  1. Your neotest configuration
  2. The version of the neotest core plugin you are using
  3. Any neotest.log output that shows how frequently the dotnet test command is running.

    • Clear out the logs
    • Start the action that causes the issue
    • Check the logs and search for DotNetUtils.get_test_full_names output

    I suspect that the dotnet test command is being triggered too often for some reason. Last time I load tested the plugin was a while ago, with an older version of neotest core, and admittedly with around 350 xunit tests.

I need to get some more info and build in some sort of caching of the command, it sounds like. Until then you can pin neotest-dotnet to commit 4ebc336c19646791b75c2ae1a30f2b8e403b9d63 to revert back to when the plugin used a different mechanism.

Issafalcon commented 6 months ago

So I've pushed some changes that will significantly reduce the number of dotnet processes that will spawn on test discovery. See how this helps @Anakael / @B3RR10 for your use cases. The performance should be something like O(1) instead of O(n) now, where n was the number of test folders, for every time the discover tests event is run in neotest core.

B3RR10 commented 6 months ago

Nice! I'll test it tomorrow. Thanks a lot!

Anakael commented 6 months ago

Now summary works fine. But before tests are discovered running test from code doesn't work: image