Performance of running a large number of source-generated tests #5043
Unanswered
hainguyenthanh5-oss
asked this question in
Q&A
Replies: 2 comments
-
|
Can you try on 1.18 please? |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
@thomhurst Thank you for your prompt support. The performance of source-generated tests in TUnit v1.18 was significantly improved. However, it's still not as good as the reflection-based test running performance using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Please refer to the attached sample solution, which simulates 10,000 unit tests using NUnit and TUnit.
TestRunnerPerformance.zip
Compile the solution in Release configuration, enabling or disabling the source generator for the Calculator.Tests.TUnit project by setting
<EnableTUnitSourceGeneration>true</EnableTUnitSourceGeneration>or<EnableTUnitSourceGeneration>false</EnableTUnitSourceGeneration>.Below are the commands to execute the unit tests:
The following table shows the results from my machine:
These results indicate that test execution is significantly slower when the source generator is enabled, which is unexpected since source-generated tests are generally considered more performant than reflected tests. Although TUnit supports Ahead-of-Time (AOT) compilation, we cannot use it in our current project.
Is this the expected behavior for the TUnit source generator?
Beta Was this translation helpful? Give feedback.
All reactions