Commit 7cf3416f authored by Noric Couderc's avatar Noric Couderc

Switched lists to streams

Thought this might help with performance (not sure it does)
parent 311ed359
......@@ -12,6 +12,7 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class SyntheticBenchmarkRunner {
......@@ -60,10 +61,8 @@ public class SyntheticBenchmarkRunner {
// We measure the running time of each application
// in the list.
List<SyntheticBenchmarkRunData> runningTimes = new ArrayList<>();
for (BCBenchmarkPackage app : toCompare) {
runningTimes.add(evaluateApplication(app));
}
List<SyntheticBenchmarkRunData> runningTimes;
runningTimes = toCompare.stream().map(this::evaluateApplication).collect(Collectors.toList());
// We fetch the data corresponding to the fastest
// application in the list.
......@@ -72,15 +71,18 @@ public class SyntheticBenchmarkRunner {
Comparator.comparingDouble(SyntheticBenchmarkRunData::getMedian)
);
for (SyntheticBenchmarkRunData rt : runningTimes) {
if (minimum.isPresent()) {
SyntheticBenchmarkRunData selected = minimum.get();
String bestDataStructure = selected.getSyntheticBenchmark().getDataStructureName();
runningTimes.forEach(
it -> {
if (minimum.isPresent()) {
SyntheticBenchmarkRunData selected = minimum.get();
String bestDataStructure = selected.getSyntheticBenchmark().getDataStructureName();
trainingSet.add(
new TrainingSetValue(rt.syntheticBenchmark, rt.getSamples(), bestDataStructure));
}
}
trainingSet.add(
new TrainingSetValue(it.syntheticBenchmark, it.getSamples(),
bestDataStructure));
}
}
);
}
return trainingSet;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment