Running some JUnit tests the overhead of instrumented code is very
important (x16). In my case instrumented code is a complex algorithm, with
many loops. I have reproduced the issue with the following test case:
Instrumented code:
public class App {
public void testCobertura() {
for (long i = 0; i < 1E+9; i++ ) {
}
}
}
and the associated JUnit test:
public class AppTest extends TestCase {
public void testApp() {
App app = new App();
app.testCobertura();
}
}
Running mvn clean test (no instrumentation):
1) with i < 1E+8 takes 0.165 sec
2) with i < 1E+9 takes 1.38 sec
Running mvn clean cobertura:cobertura (with instrumentation):
1) with i < 1E+8 takes 19 sec
2) with i < 1E+9 takes 196 sec
Now with modified cobertura sources (I have removed all lock() from
ProjectData, ClassData, LineData, ...):
1) with i < 1E+8 takes 6.6 sec
2) with i < 1E+9 takes 65 sec
For a comparison here are the mvn clean emma:emma results:
1) with i < 1E+8 takes 0.241 sec
2) with i < 1E+9 takes 1.46 sec
I guess the overhead is mainly caused by synchronization calls (lock() is
called for nearly all methods).
Nobody/Anonymous
None
None
Public