Skip to content

Commit 5badc01

Browse files
committed
Merge branch 'webdriver-transfered-sizes'
2 parents 1b67a6e + dc41394 commit 5badc01

19 files changed

+780
-47
lines changed

eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export default [
5656
"unicorn/prefer-ternary": "off",
5757
"unicorn/require-number-to-fixed-digits-argument": "off",
5858
"unicorn/prefer-set-has": "off",
59+
"unicorn/unicorn/no-array-reduce": "off",
5960
// maybe not:
6061
"unicorn/consistent-function-scoping": "off",
6162
"unicorn/no-array-for-each": "off",

server/src/responseSize/responseSizeRouter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ import { disableCompression, enableCompression, getSize } from "./responseSizeCo
33
export async function getSizeRouter(fastify) {
44
fastify.get("/enableCompression", enableCompression);
55
fastify.get("/disableCompression", disableCompression);
6-
fastify.get("/getSize", getSize);
6+
fastify.get("/sizeInfo", getSize);
77
}

webdriver-ts-results/src/Common.ts

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,17 @@ export function findIssue(issueNumber: number): Issue | undefined {
9494
export enum BenchmarkType {
9595
CPU,
9696
MEM,
97-
DUMMY,
98-
STARTUP,
97+
STARTUP=3,
98+
SIZE=5,
9999
}
100100

101+
const benchmarkTypes = [
102+
BenchmarkType.CPU,
103+
BenchmarkType.MEM,
104+
BenchmarkType.STARTUP,
105+
BenchmarkType.SIZE,
106+
];
107+
101108
export interface Benchmark {
102109
id: string;
103110
type: BenchmarkType;
@@ -133,10 +140,12 @@ interface ResultData {
133140
export const SORT_BY_NAME = "SORT_BY_NAME";
134141
export const SORT_BY_GEOMMEAN_CPU = "SORT_BY_GEOMMEAN_CPU";
135142
export const SORT_BY_GEOMMEAN_MEM = "SORT_BY_GEOMMEAN_MEM";
143+
export const SORT_BY_GEOMMEAN_SIZE = "SORT_BY_GEOMMEAN_SIZE";
136144
export const SORT_BY_GEOMMEAN_STARTUP = "SORT_BY_GEOMMEAN_STARTUP";
137145
export type T_SORT_BY_GEOMMEAN =
138146
| typeof SORT_BY_GEOMMEAN_CPU
139147
| typeof SORT_BY_GEOMMEAN_MEM
148+
| typeof SORT_BY_GEOMMEAN_SIZE
140149
| typeof SORT_BY_GEOMMEAN_STARTUP;
141150

142151
const computeColor = function (factor: number): string {
@@ -270,21 +279,9 @@ const formatEn = new Intl.NumberFormat("en-US", {
270279

271280
export class ResultTableData {
272281
resultsMap = new Map<BenchmarkType, ResultData>();
273-
// // Rows
274-
// benchmarksCPU: Array<Benchmark>;
275-
// benchmarksStartup: Array<Benchmark>;
276-
// benchmarksMEM: Array<Benchmark>;
277-
// Columns
278282
frameworks: Array<Framework>;
279283
frameworksForFactors: Array<Framework>;
280284
selectedFameworks: Set<Framework>;
281-
// Cell data
282-
// resultsCPU: Array<Array<TableResultValueEntry|null>>; // [benchmark][framework]
283-
// geomMeanCPU: Array<TableResultGeommeanEntry|null>;
284-
// geomMeanStartup: Array<TableResultGeommeanEntry|null>;
285-
// geomMeanMEM: Array<TableResultGeommeanEntry|null>;
286-
// resultsStartup: Array<Array<TableResultValueEntry|null>>;
287-
// resultsMEM: Array<Array<TableResultValueEntry|null>>;
288285

289286
constructor(
290287
public allFrameworks: Array<Framework>,
@@ -378,11 +375,6 @@ export class ResultTableData {
378375
return { benchmarks, results, geomMean, comparison };
379376
};
380377

381-
const benchmarkTypes = [
382-
BenchmarkType.CPU,
383-
BenchmarkType.MEM,
384-
BenchmarkType.STARTUP,
385-
];
386378
for (const type of benchmarkTypes) {
387379
this.resultsMap.set(type, createResult(type));
388380
}
@@ -405,6 +397,10 @@ export class ResultTableData {
405397
sortValue =
406398
this.getResult(BenchmarkType.MEM).geomMean[frameworkIndex]!.mean ||
407399
Number.POSITIVE_INFINITY;
400+
else if (sortKey === SORT_BY_GEOMMEAN_SIZE)
401+
sortValue =
402+
this.getResult(BenchmarkType.SIZE).geomMean[frameworkIndex]!.mean ||
403+
Number.POSITIVE_INFINITY;
408404
else if (sortKey === SORT_BY_GEOMMEAN_STARTUP)
409405
sortValue =
410406
this.getResult(BenchmarkType.STARTUP).geomMean[frameworkIndex]!
@@ -416,6 +412,9 @@ export class ResultTableData {
416412
const memIdx = this.getResult(BenchmarkType.MEM).benchmarks.findIndex(
417413
(b) => b.id === sortKey,
418414
);
415+
const sizeIdx = this.getResult(BenchmarkType.SIZE).benchmarks.findIndex(
416+
(b) => b.id === sortKey,
417+
);
419418
const startupIdx = this.getResult(
420419
BenchmarkType.STARTUP,
421420
).benchmarks.findIndex((b) => b.id === sortKey);
@@ -432,6 +431,10 @@ export class ResultTableData {
432431
sortValue =
433432
this.getResult(BenchmarkType.MEM).results[memIdx][frameworkIndex]
434433
?.value ?? Number.POSITIVE_INFINITY;
434+
else if (sizeIdx > -1)
435+
sortValue =
436+
this.getResult(BenchmarkType.SIZE).results[sizeIdx][frameworkIndex]
437+
?.value ?? Number.POSITIVE_INFINITY;
435438
else throw Error(`sortKey ${sortKey} not found`);
436439
}
437440
return {
@@ -447,12 +450,6 @@ export class ResultTableData {
447450

448451
this.frameworks = this.remap(remappedIdx, this.frameworks);
449452

450-
const benchmarkTypes = [
451-
BenchmarkType.CPU,
452-
BenchmarkType.MEM,
453-
BenchmarkType.STARTUP,
454-
];
455-
456453
for (const type of benchmarkTypes) {
457454
const result = this.getResult(type);
458455

@@ -588,9 +585,9 @@ export class ResultTableData {
588585
(1.959964 * (resultValues.standardDeviation || 0)) /
589586
Math.sqrt(resultValues.values.length);
590587
const conficenceIntervalStr =
591-
benchmark.type === BenchmarkType.MEM
592-
? null
593-
: conficenceInterval.toFixed(1);
588+
benchmark.type === BenchmarkType.CPU
589+
? conficenceInterval.toFixed(1)
590+
: null;
594591
const formattedValue = formatEn.format(value);
595592

596593
if (!this.compareWith) {

webdriver-ts-results/src/components/ResultTable.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import MemResultsTable from "./tables/MemResultsTable";
55
import StartupResultsTable from "./tables/StartupResultsTable";
66
import { benchmarks } from "../results";
77
import { useRootStore } from "../reducer";
8+
import SizeResultsTable from "./tables/SizeResultsTable";
89

910
const BoxPlotTable = React.lazy(() => import("./BoxPlotTable/BoxPlotTable"));
1011

@@ -75,6 +76,7 @@ const ResultTable = ({ type }: Props) => {
7576
<CpuResultsTable currentSortKey={currentSortKey} sortBy={sortBy} data={data} />
7677
<StartupResultsTable currentSortKey={currentSortKey} sortBy={sortBy} data={data} />
7778
<MemResultsTable currentSortKey={currentSortKey} sortBy={sortBy} data={data} />
79+
<SizeResultsTable currentSortKey={currentSortKey} sortBy={sortBy} data={data} />
7880
</table>
7981
</div>
8082
</div>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import React from "react";
2+
import { ResultTableData, SORT_BY_NAME, BenchmarkType, SORT_BY_GEOMMEAN_SIZE } from "../../Common";
3+
import ValueResultRow from "./ValueResultRow";
4+
import GeomMeanRow from "./GeomMeanRow";
5+
6+
interface Props {
7+
data: ResultTableData;
8+
currentSortKey: string;
9+
sortBy: (name: string) => void;
10+
}
11+
12+
const SizeResultsTable = ({ data, currentSortKey, sortBy }: Props) => {
13+
const resultsSize = data.getResult(BenchmarkType.SIZE);
14+
15+
const handleSortByName = (event: React.MouseEvent) => {
16+
event.preventDefault();
17+
sortBy(SORT_BY_NAME);
18+
};
19+
20+
return resultsSize.results.length === 0 ? null : (
21+
<>
22+
<thead>
23+
<tr>
24+
<td className="description">
25+
<h3>Transferred Size (in kBs)</h3>
26+
</td>
27+
</tr>
28+
</thead>
29+
<thead>
30+
<tr>
31+
<th className="benchname">
32+
<button className={`button button__text ${currentSortKey === SORT_BY_NAME ? "sort-key" : ""}`} onClick={handleSortByName}>
33+
Name
34+
</button>
35+
</th>
36+
{data.frameworks.map((f) => (
37+
<th key={f.displayname}>{f.displayname}</th>
38+
))}
39+
</tr>
40+
</thead>
41+
<tbody>
42+
{resultsSize.results.map((resultsForBenchmark, benchIdx) => (
43+
<ValueResultRow
44+
key={resultsSize.benchmarks[benchIdx]?.id}
45+
benchIdx={benchIdx}
46+
resultsForBenchmark={resultsForBenchmark}
47+
benchmarks={resultsSize.benchmarks}
48+
currentSortKey={currentSortKey}
49+
sortBy={sortBy}
50+
/>
51+
))}
52+
<GeomMeanRow weighted={false} currentSortKey={currentSortKey} sortBy={sortBy} geomMean={resultsSize.geomMean} sortbyGeommeanEnum={SORT_BY_GEOMMEAN_SIZE} />
53+
</tbody>
54+
</>
55+
);
56+
};
57+
58+
export default SizeResultsTable;

0 commit comments

Comments
 (0)