smart-testing icon indicating copy to clipboard operation
smart-testing copied to clipboard

Improve Smart Testing Performance

Open dipak-pawar opened this issue 8 years ago • 10 comments

  • Run Smart-Testing with any real project.
  • Find all areas which impacts execution time/performance using profiling.
  • After finding all areas, find optimized solutions for it.

dipak-pawar avatar Oct 18 '17 11:10 dipak-pawar

I have one idea how to improve the performance: The calculations (scm) would be executed in a separated thread, so the main thread wouldn't be blocked and could continue with the Maven build. I guess that calculation should be probably finished before the surefire execution starts (in most of the cases), but this has to be managed anyway (in cases when it takes more time than the compilation etc...). To avoid the state when the surefire starts before the calculation is finished and tries to read non-existing or uncomplete scm-changes file, the logic should use some marker. This marker can be a temporary empty file that would represent that the execution is still being processed. When the calculation execution is finished, the file is removed. On the surefire side, this file would be checked if whether still exists or not. If not, then it can start looking/reading the scm-changes file and continue with normal test execution.

MatousJobanek avatar Oct 19 '17 14:10 MatousJobanek

Yes it is a good idea, even we could create some kind of chain on this. For example when scm changes has been calculated, if affected strategy is enabled, start calculating graph too. But maybe this is something to take into consideration as next step.

lordofthejars avatar Oct 19 '17 14:10 lordofthejars

@lordofthejars IIRC you have some big project with a lot of test classes. Is it AssertJ or something else?

MatousJobanek avatar Oct 24 '17 14:10 MatousJobanek

if affected strategy is enabled

If we don't want to detect which strategies are activated in the maven extension phase, then we cannot create this kind of chain. Instead of chaining the strategy specific tasks, we could introduce another level of optimization - running the activated strategy implementations in parallel.

MatousJobanek avatar Oct 24 '17 14:10 MatousJobanek

Yes it was just assertj

lordofthejars avatar Oct 24 '17 15:10 lordofthejars

@lordofthejars can you share modified project so we can have a simple reference to reproducer?

bartoszmajsak avatar Oct 24 '17 16:10 bartoszmajsak

There were no modification, I just cloned the assertj project and modified org.assertj.core.util.Strings_join_Test with one redundant test

lordofthejars avatar Oct 24 '17 16:10 lordofthejars

And how did you execute the build? Which version of ST was defined in extensions.xml?

bartoszmajsak avatar Oct 24 '17 16:10 bartoszmajsak

In the git history of workshop you can see next things if you want to reproduce exactly the same thing:

  • Affected strategy: https://github.com/lordofthejars/smart-testing-workshop/commit/f36cf842747b50f9f5cf7155ebbe774bac7d370b

You need to run this using affected strategy and it is where the 2 million nodes are created.

  • Changed: https://github.com/lordofthejars/smart-testing-workshop/commit/951b7c576ce149c93d203d689dd77c0edf82d5c9

You need to run this using changed strategy, but no performance issues observed at that time.

lordofthejars avatar Oct 24 '17 16:10 lordofthejars

Thanks, that's exactly the context we will need when we dive into this analysis!

bartoszmajsak avatar Oct 24 '17 17:10 bartoszmajsak