Commit fd5d9dd7 authored by Noric Couderc's avatar Noric Couderc

Optimization: Clear list when data is processed

We used groupby and then processed each group, so we can clear as we go.
parent 56b0b446
......@@ -46,6 +46,7 @@ public class TraceBenchmarkRunner extends SyntheticBenchmarkRunner {
suggestions.add(
new TrainingSetValue.CollectionSuggestion(location, currentType, bestType)
);
g.getValue().clear();
}
return suggestions;
}
......@@ -67,6 +68,7 @@ public class TraceBenchmarkRunner extends SyntheticBenchmarkRunner {
for (Map.Entry<String, List<TrainingSetValue>> e : groupedByCollection.entrySet()) {
double sum = e.getValue().stream().map(it -> it.getAverage()).mapToDouble(it -> it).sum();
sumRunningTimePerType.put(sum, e.getKey());
e.getValue().clear(); // We have all the data we need
}
// You return the type that had the _LOWEST_ average runtime
return sumRunningTimePerType.firstEntry().getValue();
......
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