Closed thinkbeforecoding closed 2 months ago
Thanks for reporting this. Could you please use the latest coverlet.msbuild preview and check the performance.
I've done tests with the preview nuget and they show no improvements, sadly.
OK that's really interesting. I can remember that we had other issues reported with inlined methods some time ago, e.g. #1225. Probably they changed something there, more generated code, emitted additional sequence points... It would be helpful if somebody could provide a simple repro where this increased instrumentation time can be seen when switching between 8.0.1 - 8.0.2.
I have no independent repro yet, but I used perfview to see what the process was doing (this last like 8 or 9 minutes, while it was a few seconds before)
The sampling was done on 17 sec.
A flame graph on a similar sample:
And another one :
So, after more test, it found that is was truly linked to the size of methods due to F# inlining.
Two keypoints:
A least, forcing the --optimize+
flag during F# compilation produces a far smaller IL (without all the dead branches), and the timing is back to normal.
I have observed the same on a rather large C# solution. With .net 6 test runs in under 10 minutes. After updating to .net 8 I gave up on the tests after an hour. (When actual tests were running they were faster in .net8 than .ner6, so but it takes forever to get to the test, so I assume it is the.instrumentation that takes a long time)
We also have problems with huge performance degradation... (unit test run from 2mins to 14mins)... it seems that downgrading to coverlet v6.0.1 fixes the problem and the problem is only with v6.0.2...
@thinkbeforecoding can you try whether this works for you as well?
We also noticed this on our medium size C# solution (68 projects), when we updated our coverlet version while using .net 8.
Dropping back to the previous version works.
Seems to take a minute or so to start test execution, for each test project. Note the column on the right is time since started. It normally takes ~10s in our CI system.
Duplicate issue exists #1649
Describe the bug The tests using coverlet used to be correctly fast, but since installing dotnet sdk 8.0.200 (released on 2024-02-13), the time skyrocketed from 15 seconds to > 7min. This is happening on two different tests projects which are not especially large.
To Reproduce Hard to say, some other projects have not significantly changed. I suspect that these projects contain a few large methods (using nested inline methods in F#), but it used to be instrumented far faster.
Expected behavior Instrumentation time should remain in the same range as before.
Actual behavior The time in instrumentation is very long:
Configuration (please complete the following information): Please provide more information on your .NET configuration:
Additional context The only specific thing in the test dependency is a few methods that can be highly inlined at compilation (using F# inline keyword) and can be large. Other projects don't seem to be as much impacted.