All Versions
Clover 4.0 DocumentationClover 3.3 Documentation
Clover 3.2 Documentation
More...
This page contains few sample performance results based on a synthetic and a real code. Results in your project may be different.
A following open source libraries were tested using statement- and method-level instrumentation.
Standard test of unit tests was executed and a total time of test execution was measured.
(*) only 200 test classes were executed for Commons Math
Performance penalty for a method and statement instrumentation level may vary significantly, especially for CPU-intensive applications.
Strategy | System properties | Comment |
---|---|---|
disabled | -Dclover.pertest.coverage=off | Use this if to disable per-test coverage recording. |
diffing | -Dclover.pertest.coverage=diff | Theoretically it is good for highly CPU-intensive code (lot of hit counts to be recorded) and a relatively small code base (smaller hit count arrays to be compared). |
single threaded | (nothing) | Default strategy. Designed for single-threaded applications. Per-test coverage might be inaccurate if used with multi-threaded application. Very good performance. |
synchronized | -Dclover.pertest.coverage.threading=synchronized | Safe for multi-threaded applications. Performance penalty as recording of every hit count is encapsulated in synchronized block. |
volatile | -Dclover.pertest.coverage.threading=volatile | Safe for multi-threaded applications, but requires at least JRE 1.5. |
The following class:
import junit.framework.TestCase; public class PerformanceTest extends TestCase { static int hitsPerTest; static int numberOfTests; public void testPerformance() { for (int i = 0; i < hitsPerTest; i++); // empty loop, one R.inc(...) call per loop } public static void main(String[] args) { numberOfTests = Integer.valueOf(args[0]); hitsPerTest = Integer.valueOf(args[1]); PerformanceTest pt = new PerformanceTest(); for (int i = 0; i < numberOfTests; i++) { pt.testPerformance(); } } }
was instrumented using Fixed Coverage Recorder and executed with different per-test recording strategies. In order to have roughly 10'000'000 hits recorded by Clover, application was executed with following arguments:
PerformanceTest 10 1000000
PerformanceTest 20 500000
PerformanceTest 50 200000
PerformanceTest 100 100000
PerformanceTest 200 500000
PerformanceTest 500 200000
PerformanceTest 1000 10000
PerformanceTest 10000 1000
Test environment: JDK 1.5, Windows 7; Core i7 2670QM 2.2 GHz; 8GB RAM; HDD 750GB 7200RPM.
For a large number of tests, performance is mainly affected by a fact that the coverage recording file is being created on a hard disk. If you have more than 1000 tests there is practically no difference which strategy is used.
For CPU intensive applications the "diffing" strategy is slightly faster than the "single-threaded" or "volatile".