Remco;10185 wrote:Grendil;10183 wrote:Ah, thanks for this diagnostic tip!
So I turned on that setting, reloaded the IDE, waited for NCrunch to do its initial build and analysis, and made sure it was in manual engine mode. When it was idle I ran one test. That took about 16 sec, nearly all of which was "Invoke Nunit 3 to load tests". I then went to another test and edited some test code, and pretty quickly noticed the Analyse Assembly step processing in the NCrunch process queue. So I immediately reran the first test to see what the execution log would look like now. This time it's 16 seconds of "Augment test discovery results with NCrunch metadata" and another 16 seconds of "Invoke NUnit 3 to load tests" (that part is like the first run).
Does that shed any useful light? This was a pretty quick exercise, if it would be helpful I can collect more sample data.
This is interesting. The 'Invoke NUnit3 to load tests' step involves loading your assembly into a runtime environment, then using reflection to traverse it and build a suite of tests. Basically, this is NUnit3's internal test discovery step.
The 'Augment test discovery results with NCrunch metadata' step involves iterating through your discovered tests and using reflection to discover additional NCrunch attributes, then collecting data from these attributes as input to NCrunch's engine.
So we basically have two reflection-heavy steps that take a long time.
Roughly how many types and methods do you have in this particular assembly?
So this particular assembly has about 75 types and about 600 methods. Most of this is tests, but there is also some test support code. We're starting to use AutoFixture with Moq to setup tests, and some of the tests have non-trivial attributes that drive that behavior as well. This assembly also has references to about 50 other projects from our solution. As I mentioned earlier, I normally leave all but a few of those projects unloaded using Funnel.
Speaking of Funnel, when loading the entire solution without filtering, ReSharper also bogs down a lot, and VS 2015 itself sometimes struggles. So it would not surprise me if NUnit and/or NCrunch had trouble staying zippy if it was frequently analyzing the entire solution (125+ projects) looking for tests.
I know VS 2017 has some built in support for "lightweight solutions", but we haven't switched over yet. Perhaps that will help?
Also is there a way to reduce the search scope of "Analyse Assembly" with some kind of filter setting? Perhaps that's the wrong idea, but I just saw that when I make even a very minor change to a code file (adding a single space) Analyse Assembly ran for over 40 seconds. At that point it is faster to just build and run a test with ReSharper, so I'm longing for ways to get NCrunch responding faster.