Skip to content

Commit b0eb756

Browse files
committed
prototype for dynamic benchmark loop count
1 parent 490fc79 commit b0eb756

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

webdriver-ts/src/benchmarks.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@ export interface BenchmarkInfo {
1111
type: BenchmarkType;
1212
label: string;
1313
description: string;
14+
dynamicCountMultiplicity?: number
1415
}
1516

1617
export abstract class Benchmark {
1718
id: string;
1819
type: BenchmarkType;
1920
label: string;
2021
description: string;
22+
dynamicCountMultiplicity?: number
23+
2124
constructor(public benchmarkInfo: BenchmarkInfo) {
2225
this.id = benchmarkInfo.id;
2326
this.type = benchmarkInfo.type;
2427
this.label = benchmarkInfo.label;
2528
this.description = benchmarkInfo.description;
29+
this.dynamicCountMultiplicity = benchmarkInfo.dynamicCountMultiplicity;
2630
}
2731
abstract init(driver: WebDriver, framework: FrameworkData): Promise<any>;
2832
abstract run(driver: WebDriver, framework: FrameworkData): Promise<any>;
@@ -50,7 +54,8 @@ const benchRun = new class extends Benchmark {
5054
id: "01_run1k",
5155
label: "create rows",
5256
description: "Duration for creating 1000 rows after the page loaded.",
53-
type: BenchmarkType.CPU
57+
type: BenchmarkType.CPU,
58+
dynamicCountMultiplicity: 3
5459
})
5560
}
5661
async init(driver: WebDriver) { await testElementLocatedById(driver, "add", SHORT_TIMEOUT); }
@@ -67,6 +72,7 @@ const benchReplaceAll = new class extends Benchmark {
6772
label: "replace all rows",
6873
description: "Duration for updating all 1000 rows of the table (with " + config.WARMUP_COUNT + " warmup iterations).",
6974
type: BenchmarkType.CPU,
75+
dynamicCountMultiplicity: 3
7076
})
7177
}
7278
async init(driver: WebDriver) {
@@ -88,6 +94,7 @@ const benchUpdate = new class extends Benchmark {
8894
label: "partial update",
8995
description: "Time to update the text of every 10th row (with " + config.WARMUP_COUNT + " warmup iterations) for a table with 10k rows.",
9096
type: BenchmarkType.CPU,
97+
dynamicCountMultiplicity: 3
9198
})
9299
}
93100
async init(driver: WebDriver) {
@@ -112,6 +119,7 @@ const benchSelect = new class extends Benchmark {
112119
label: "select row",
113120
description: "Duration to highlight a row in response to a click on the row. (with " + config.WARMUP_COUNT + " warmup iterations).",
114121
type: BenchmarkType.CPU,
122+
dynamicCountMultiplicity: 6
115123
})
116124
}
117125
async init(driver: WebDriver) {
@@ -135,6 +143,7 @@ const benchSwapRows = new class extends Benchmark {
135143
label: "swap rows",
136144
description: "Time to swap 2 rows on a 1K table. (with " + config.WARMUP_COUNT + " warmup iterations).",
137145
type: BenchmarkType.CPU,
146+
dynamicCountMultiplicity: 6
138147
})
139148
}
140149
async init(driver: WebDriver) {
@@ -161,6 +170,7 @@ const benchRemove = new class extends Benchmark {
161170
label: "remove row",
162171
description: "Duration to remove a row. (with " + config.WARMUP_COUNT + " warmup iterations).",
163172
type: BenchmarkType.CPU,
173+
dynamicCountMultiplicity: 4
164174
})
165175
}
166176
async init(driver: WebDriver) {
@@ -188,6 +198,7 @@ const benchRunBig = new class extends Benchmark {
188198
label: "create many rows",
189199
description: "Duration to create 10,000 rows",
190200
type: BenchmarkType.CPU,
201+
dynamicCountMultiplicity: 1
191202
})
192203
}
193204
async init(driver: WebDriver) {
@@ -206,6 +217,7 @@ const benchAppendToManyRows = new class extends Benchmark {
206217
label: "append rows to large table",
207218
description: "Duration for adding 1000 rows on a table of 10,000 rows.",
208219
type: BenchmarkType.CPU,
220+
dynamicCountMultiplicity: 1
209221
})
210222
}
211223
async init(driver: WebDriver) {
@@ -226,6 +238,7 @@ const benchClear = new class extends Benchmark {
226238
label: "clear rows",
227239
description: "Duration to clear the table filled with 10.000 rows.",
228240
type: BenchmarkType.CPU,
241+
dynamicCountMultiplicity: 3
229242
})
230243
}
231244
async init(driver: WebDriver) {

0 commit comments

Comments
 (0)