Skip to content

Commit

Permalink
Use again average that removes worst case
Browse files Browse the repository at this point in the history
  • Loading branch information
planger committed Oct 5, 2023
1 parent 50ced9e commit 00d27f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/performance-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export async function readEntries(path: string, values: string[]): Promise<{ val
*
* @param values raw values as read from performance metrics files (key is the label of the value, value is the history of values),
* whereas the ValueHistory.history` of each entry must be sorted ascending by date and run.
* @returns post processed values with the averages and best of ten values of multiple runs.
* @returns post processed values with the average values and best of ten values of multiple runs.
*/
export function processValues(values: Map<string, ValueHistory>): Map<string, ValueHistory> {
const processedValues = new Map<string, ValueHistory>();
Expand Down Expand Up @@ -356,6 +356,11 @@ function toCombinedValueHistoryEntry(entries: ValueHistoryEntry[]): ValueHistory
}

function averageValue(values: number[]): number {
if (values.length > 1) {
// remove worst outlier
values = values.sort();
values.pop();
}
return values.reduce((a, b) => a + b, 0) / values.length;
}

Expand Down

0 comments on commit 00d27f6

Please sign in to comment.