Skip to content

Commit

Permalink
reduce result size
Browse files Browse the repository at this point in the history
  • Loading branch information
krausest committed Mar 9, 2024
1 parent c1a761f commit 3d5ed63
Show file tree
Hide file tree
Showing 7 changed files with 245 additions and 3,500 deletions.
8 changes: 5 additions & 3 deletions webdriver-ts-results/src/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,11 @@ export interface Benchmark {
}

export interface RawResult {
f: string;
b: string;
v: { [k: string]: number[] };
f: number;
b: {
b: number;
v: { [k: string]: number[] };
}[];
}

export interface ResultValues {
Expand Down
31 changes: 17 additions & 14 deletions webdriver-ts-results/src/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,24 @@ import {

const benchmarks = rawBenchmarks;

const results: Result[] = rawResults.map((result) => {
const values: { [k: string]: ResultValues } = {};
for (const key of Object.keys(result.v)) {
const r = result.v[key];
const vals = {
mean: r ? jStat.mean(r) : Number.NaN,
median: r ? jStat.median(r) : Number.NaN,
standardDeviation: r ? jStat.stdev(r, true) : Number.NaN,
values: r,
};
values[key] = vals;
const results: Result[] = [];
for (let result of rawResults) {
for (let b of result.b) {
const values: { [k: string]: ResultValues } = {};
for (const key of Object.keys(b.v)) {
const r = b.v[key];
const vals = {
mean: r ? jStat.mean(r) : Number.NaN,
median: r ? jStat.median(r) : Number.NaN,
standardDeviation: r ? jStat.stdev(r, true) : Number.NaN,
values: r,
};
values[key] = vals;
}
results.push({ framework: frameworks[result.f].name, benchmark: benchmarks[b.b].id, results: values });
}

return { framework: result.f, benchmark: result.b, results: values };
});
}
console.log(results)

const removeKeyedSuffix = (value: string) => {
if (value.endsWith("-non-keyed")) return value.slice(0, -10);
Expand Down
3,673 changes: 204 additions & 3,469 deletions webdriver-ts-results/src/results.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webdriver-ts/results.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions webdriver-ts/src/benchmarksSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ export const benchUncompressedSize: benchmarksCommon.SizeBenchmarkInfo = {
label: "uncompressed size",
description: "uncompressed size of all implementation files (excluding /css and http headers)",
type: BenchmarkType.SIZE,
fn: (sizeInfo) => toKb(sizeInfo.size_uncompressed),
fn: (sizeInfo) => Number(toKb(sizeInfo.size_uncompressed).toFixed(1)),
};

export const benchCompressedSize: benchmarksCommon.SizeBenchmarkInfo = {
id: "42_size-compressed",
label: "compressed size",
description: "brotli compressed size of all implementation files (excluding /css and http headers)",
type: BenchmarkType.SIZE,
fn: (sizeInfo) => toKb(sizeInfo.size_compressed),
fn: (sizeInfo) => Number(toKb(sizeInfo.size_compressed).toFixed(1)),
};

export const benchFP: benchmarksCommon.SizeBenchmarkInfo = {
Expand Down
21 changes: 13 additions & 8 deletions webdriver-ts/src/createResultJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,12 @@ async function main() {
}
});

frameworks.forEach((framework) => {
allBenchmarks.forEach((benchmarkInfo) => {
frameworks.forEach((framework,idx) => {
let result: any = {
f: idx,
b: []
};
allBenchmarks.forEach((benchmarkInfo) => {
if (!args.browser || framework.keyed) {
let name = `${fileName(framework, benchmarkInfo)}`;
let file = `${resultsDirectory}/${name}`;
Expand Down Expand Up @@ -120,24 +124,25 @@ async function main() {
);
}
}
let result: any = {
f: data.framework,
b: data.benchmark,
v: values,
};
result.b.push({
b: allBenchmarks.findIndex((b) => b.id== data.benchmark),
v: values,
});
let resultNice = {
framework: data.framework,
benchmark: data.benchmark,
values: values,
};

resultJS += "\n" + JSON.stringify(result) + ",";
jsonResult.push(resultNice);
} else {
console.log("MISSING FILE", file);
}
}
});
resultJS += "\n" + JSON.stringify(result, function(key, val) {
return val.toFixed ? Number(val.toFixed(1)) : val;
}) + ",";
});

resultJS += "];\n";
Expand Down
6 changes: 3 additions & 3 deletions webdriver-ts/src/writeResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ export function writeResults(resultDir: string, res: ResultLightHouse | ResultCP
case BenchmarkType.CPU:
createResultFile(
resultDir,
{ total: res.results.map((r) => r.total),
script: res.results.map((r) => r.script),
paint: res.results.map((r) => r.paint),
{ total: res.results.map((r) => Number(r.total.toFixed(1))),
script: res.results.map((r) => Number(r.script.toFixed(1))),
paint: res.results.map((r) => Number(r.paint.toFixed(1))),
},
res.framework,
res.benchmark
Expand Down

0 comments on commit 3d5ed63

Please sign in to comment.