-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parallelize coverage analysis in CoveredTestResultPerTestMethod #112
Parallelize coverage analysis in CoveredTestResultPerTestMethod #112
Conversation
Signed-off-by: André Silva <[email protected]>
1eeb5e1
to
b444b74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you very much!
Only the code duplication is a bit frustrating, but I do not see another way.
Could we put the following code:
// We need to clone each result so it doesn't get changed by the runtime afterwards
ExecutionDataStore executionDataStore = new ExecutionDataStore();
this.internalCoveredTestResult.getExecutionData().getContents().stream().forEach(x -> {
ExecutionData executionData = new ExecutionData(x.getId(), x.getName(), x.getProbes().clone());
synchronized (executionDataStore) {
executionDataStore.put(executionData);
}
});
this.internalCoveredTestResult.getExecutionDataStoreMap().put(
this.toString.apply(testIdentifier),
executionDataStore
);
In a "Utils" class, in order to avoid the duplication? Like something:
public static void cloneAndAddExecutionDataStore(CoveredTestResultPerTestMethod internalCoveredTestResult, Function<Description, String) toString) {
// We need to clone each result so it doesn't get changed by the runtime afterwards
ExecutionDataStore executionDataStore = new ExecutionDataStore();
internalCoveredTestResult.getExecutionData().getContents().stream().forEach(x -> {
ExecutionData executionData = new ExecutionData(x.getId(), x.getName(), x.getProbes().clone());
synchronized (executionDataStore) {
executionDataStore.put(executionData);
}
});
internalCoveredTestResult.getExecutionDataStoreMap().put(
toString.apply(description),
executionDataStore
);
}
Signed-off-by: André Silva <[email protected]>
Hi @danglotb , Yes, for sure. I moved the cloning into an Utils class, but not the insertion since they are different implementation classes. |
Running the jacoco analyzer is an expensive operation.
Unfortunately, jacoco doesn't provide a way of doing an analysis of several executions at once, which is why test-runner needs to analyze them separately.
This PR introduces parallelism in that stage, moving analysis from the end of each test case to the end of the entire test suite and running it inside of a parallel stream.
Running flacoco with this modification on
math70
on my PC (4 cores) reduced the execution time by around 40%.