@@ -4,6 +4,67 @@ import { config, FrameworkData } from './common'
44
55export enum BenchmarkType { CPU , MEM , STARTUP } ;
66
7+ const BENCHMARK_01 = "01_run1k" ;
8+ const BENCHMARK_02 = "02_replace1k" ;
9+ const BENCHMARK_03 = "03_update10th1k_x16" ;
10+ const BENCHMARK_04 = "04_select1k" ;
11+ const BENCHMARK_05 = "05_swap1k" ;
12+ const BENCHMARK_06 = "06_remove-one-1k" ;
13+ const BENCHMARK_07 = "07_create10k" ;
14+ const BENCHMARK_08 = "08_create1k-after1k_x2" ;
15+ const BENCHMARK_09 = "09_clear1k_x8" ;
16+ const BENCHMARK_21 = "21_ready-memory" ;
17+ const BENCHMARK_22 = "22_run-memory" ;
18+ const BENCHMARK_23 = "23_update5-memory" ;
19+ const BENCHMARK_24 = "24_run5-memory" ;
20+ const BENCHMARK_25 = "25_run-clear-memory" ;
21+ const BENCHMARK_31 = "31_startup-ci" ;
22+
23+ type TBenchmarkID =
24+ | typeof BENCHMARK_01
25+ | typeof BENCHMARK_02
26+ | typeof BENCHMARK_03
27+ | typeof BENCHMARK_04
28+ | typeof BENCHMARK_05
29+ | typeof BENCHMARK_06
30+ | typeof BENCHMARK_07
31+ | typeof BENCHMARK_08
32+ | typeof BENCHMARK_09
33+ | typeof BENCHMARK_21
34+ | typeof BENCHMARK_22
35+ | typeof BENCHMARK_23
36+ | typeof BENCHMARK_25
37+ | typeof BENCHMARK_31 ;
38+
39+ type ISlowDowns = {
40+ [ key in TBenchmarkID ] ?: number ;
41+ } ;
42+
43+ const slowDownsOSX : ISlowDowns = {
44+ [ BENCHMARK_03 ] : 2 ,
45+ [ BENCHMARK_04 ] : 4 ,
46+ [ BENCHMARK_05 ] : 2 ,
47+ [ BENCHMARK_09 ] : 2 ,
48+ } ;
49+
50+ const slowDownsLinux : ISlowDowns = {
51+ [ BENCHMARK_03 ] : 16 ,
52+ [ BENCHMARK_04 ] : 16 ,
53+ [ BENCHMARK_05 ] : 4 ,
54+ [ BENCHMARK_08 ] : 2 ,
55+ [ BENCHMARK_09 ] : 8 ,
56+ } ;
57+
58+ const slowDowns : ISlowDowns = process . platform == "darwin" ? slowDownsOSX : slowDownsLinux ;
59+
60+ function slowDownNote ( benchmark : TBenchmarkID ) : string {
61+ return slowDowns [ benchmark ] ? " " + slowDowns [ benchmark ] + "x CPU slowdown." : "" ;
62+ }
63+
64+ function slowDownFactor ( benchmark : TBenchmarkID ) : number | undefined {
65+ return slowDowns [ benchmark ] ? slowDowns [ benchmark ] : undefined ;
66+ }
67+
768const SHORT_TIMEOUT = 20 * 1000 ;
869
970export interface BenchmarkInfo {
@@ -54,12 +115,13 @@ export interface StartupBenchmarkResult extends BenchmarkInfo {
54115const benchRun = new class extends Benchmark {
55116 constructor ( ) {
56117 super ( {
57- id : "01_run1k" ,
58- label : "create rows" ,
59- description : "creating 1,000 rows" ,
60- type : BenchmarkType . CPU ,
61- allowBatching : true
62- } )
118+ id : BENCHMARK_01 ,
119+ label : "create rows" ,
120+ description : "creating 1,000 rows" + slowDownNote ( BENCHMARK_01 ) ,
121+ type : BenchmarkType . CPU ,
122+ throttleCPU : slowDownFactor ( BENCHMARK_01 ) ,
123+ allowBatching : true ,
124+ } ) ;
63125 }
64126 async init ( driver : WebDriver ) { await testElementLocatedById ( driver , "add" , SHORT_TIMEOUT , true ) ; }
65127 async run ( driver : WebDriver ) {
@@ -71,12 +133,14 @@ const benchRun = new class extends Benchmark {
71133const benchReplaceAll = new class extends Benchmark {
72134 constructor ( ) {
73135 super ( {
74- id : "02_replace1k" ,
75- label : "replace all rows" ,
76- description : "updating all 1,000 rows (" + config . WARMUP_COUNT + " warmup runs)." ,
77- type : BenchmarkType . CPU ,
78- allowBatching : true
79- } )
136+ id : BENCHMARK_02 ,
137+ label : "replace all rows" ,
138+ description : "updating all 1,000 rows (" + config . WARMUP_COUNT +
139+ " warmup runs)." + slowDownNote ( BENCHMARK_02 ) ,
140+ type : BenchmarkType . CPU ,
141+ throttleCPU : slowDownFactor ( BENCHMARK_02 ) ,
142+ allowBatching : true ,
143+ } ) ;
80144 }
81145 async init ( driver : WebDriver ) {
82146 await testElementLocatedById ( driver , 'run' , SHORT_TIMEOUT , true ) ;
@@ -94,13 +158,14 @@ const benchReplaceAll = new class extends Benchmark {
94158const benchUpdate = new class extends Benchmark {
95159 constructor ( ) {
96160 super ( {
97- id : "03_update10th1k_x16" ,
98- label : "partial update" ,
99- description : "updating every 10th row for 1,000 rows (3 warmup runs). 16x CPU slowdown." ,
100- type : BenchmarkType . CPU ,
101- throttleCPU : 16 ,
102- allowBatching : true
103- } )
161+ id : BENCHMARK_03 ,
162+ label : "partial update" ,
163+ description : "updating every 10th row for 1,000 rows (3 warmup runs)." +
164+ slowDownNote ( BENCHMARK_03 ) ,
165+ type : BenchmarkType . CPU ,
166+ throttleCPU : slowDownFactor ( BENCHMARK_03 ) ,
167+ allowBatching : true ,
168+ } ) ;
104169 }
105170 async init ( driver : WebDriver ) {
106171 await testElementLocatedById ( driver , "run" , SHORT_TIMEOUT , true ) ;
@@ -120,13 +185,14 @@ const benchUpdate = new class extends Benchmark {
120185const benchSelect = new class extends Benchmark {
121186 constructor ( ) {
122187 super ( {
123- id : "04_select1k" ,
124- label : "select row" ,
125- description : "highlighting a selected row. (no warmup runs). 16x CPU slowdown." ,
126- type : BenchmarkType . CPU ,
127- throttleCPU : 16 ,
128- allowBatching : true
129- } )
188+ id : BENCHMARK_04 ,
189+ label : "select row" ,
190+ description : "highlighting a selected row. (no warmup runs)." +
191+ slowDownNote ( BENCHMARK_04 ) ,
192+ type : BenchmarkType . CPU ,
193+ throttleCPU : slowDownFactor ( BENCHMARK_04 ) ,
194+ allowBatching : true ,
195+ } ) ;
130196 }
131197 async init ( driver : WebDriver ) {
132198 await testElementLocatedById ( driver , "run" , SHORT_TIMEOUT , true ) ;
@@ -142,13 +208,15 @@ const benchSelect = new class extends Benchmark {
142208const benchSwapRows = new class extends Benchmark {
143209 constructor ( ) {
144210 super ( {
145- id : "05_swap1k" ,
146- label : "swap rows" ,
147- description : "swap 2 rows for table with 1,000 rows. (" + config . WARMUP_COUNT + " warmup runs). 4x CPU slowdown." ,
148- type : BenchmarkType . CPU ,
149- throttleCPU : 4 ,
150- allowBatching : true
151- } )
211+ id : BENCHMARK_05 ,
212+ label : "swap rows" ,
213+ description : "swap 2 rows for table with 1,000 rows. (" +
214+ config . WARMUP_COUNT + " warmup runs)." +
215+ slowDownNote ( BENCHMARK_05 ) ,
216+ type : BenchmarkType . CPU ,
217+ throttleCPU : slowDownFactor ( BENCHMARK_05 ) ,
218+ allowBatching : true ,
219+ } ) ;
152220 }
153221 async init ( driver : WebDriver ) {
154222 await testElementLocatedById ( driver , "run" , SHORT_TIMEOUT , true ) ;
@@ -170,12 +238,14 @@ const benchSwapRows = new class extends Benchmark {
170238const benchRemove = new class extends Benchmark {
171239 constructor ( ) {
172240 super ( {
173- id : "06_remove-one-1k" ,
174- label : "remove row" ,
175- description : "removing one row. (" + config . WARMUP_COUNT + " warmup runs)." ,
176- type : BenchmarkType . CPU ,
177- allowBatching : true
178- } )
241+ id : BENCHMARK_06 ,
242+ label : "remove row" ,
243+ description : "removing one row. (" + config . WARMUP_COUNT + " warmup runs)." +
244+ slowDownNote ( BENCHMARK_06 ) ,
245+ type : BenchmarkType . CPU ,
246+ throttleCPU : slowDownFactor ( BENCHMARK_06 ) ,
247+ allowBatching : true ,
248+ } ) ;
179249 }
180250 async init ( driver : WebDriver ) {
181251 await testElementLocatedById ( driver , "run" , SHORT_TIMEOUT , true ) ;
@@ -204,12 +274,13 @@ const benchRemove = new class extends Benchmark {
204274const benchRunBig = new class extends Benchmark {
205275 constructor ( ) {
206276 super ( {
207- id : "07_create10k" ,
208- label : "create many rows" ,
209- description : "creating 10,000 rows" ,
210- type : BenchmarkType . CPU ,
211- allowBatching : true
212- } )
277+ id : BENCHMARK_07 ,
278+ label : "create many rows" + slowDownNote ( BENCHMARK_07 ) ,
279+ description : "creating 10,000 rows" ,
280+ type : BenchmarkType . CPU ,
281+ throttleCPU : slowDownFactor ( BENCHMARK_07 ) ,
282+ allowBatching : true ,
283+ } ) ;
213284 }
214285 async init ( driver : WebDriver ) {
215286 await testElementLocatedById ( driver , "runlots" , SHORT_TIMEOUT , true ) ;
@@ -223,13 +294,14 @@ const benchRunBig = new class extends Benchmark {
223294const benchAppendToManyRows = new class extends Benchmark {
224295 constructor ( ) {
225296 super ( {
226- id : "08_create1k-after1k_x2" ,
227- label : "append rows to large table" ,
228- description : "appending 1,000 to a table of 10,000 rows. 2x CPU slowdown" ,
229- type : BenchmarkType . CPU ,
230- throttleCPU : 2 ,
231- allowBatching : true
232- } )
297+ id : BENCHMARK_08 ,
298+ label : "append rows to large table" ,
299+ description : "appending 1,000 to a table of 10,000 rows." +
300+ slowDownNote ( BENCHMARK_08 ) ,
301+ type : BenchmarkType . CPU ,
302+ throttleCPU : slowDownFactor ( BENCHMARK_08 ) ,
303+ allowBatching : true ,
304+ } ) ;
233305 }
234306 async init ( driver : WebDriver ) {
235307 await testElementLocatedById ( driver , "run" , SHORT_TIMEOUT , true ) ;
@@ -245,13 +317,13 @@ const benchAppendToManyRows = new class extends Benchmark {
245317const benchClear = new class extends Benchmark {
246318 constructor ( ) {
247319 super ( {
248- id : "09_clear1k_x8" ,
249- label : "clear rows" ,
250- description : "clearing a table with 1,000 rows. 8x CPU slowdown" ,
251- type : BenchmarkType . CPU ,
252- throttleCPU : 8 ,
253- allowBatching : true
254- } )
320+ id : BENCHMARK_09 ,
321+ label : "clear rows" ,
322+ description : "clearing a table with 1,000 rows." + slowDownNote ( BENCHMARK_09 ) ,
323+ type : BenchmarkType . CPU ,
324+ throttleCPU : slowDownFactor ( BENCHMARK_09 ) ,
325+ allowBatching : true ,
326+ } ) ;
255327 }
256328 async init ( driver : WebDriver ) {
257329 await testElementLocatedById ( driver , "run" , SHORT_TIMEOUT , true ) ;
@@ -267,12 +339,12 @@ const benchClear = new class extends Benchmark {
267339const benchReadyMemory = new class extends Benchmark {
268340 constructor ( ) {
269341 super ( {
270- id : "21_ready-memory" ,
271- label : "ready memory" ,
272- description : "Memory usage after page load." ,
273- type : BenchmarkType . MEM ,
274- allowBatching : false
275- } )
342+ id : BENCHMARK_21 ,
343+ label : "ready memory" ,
344+ description : "Memory usage after page load." ,
345+ type : BenchmarkType . MEM ,
346+ allowBatching : false ,
347+ } ) ;
276348 }
277349 async init ( driver : WebDriver ) {
278350 await testElementLocatedById ( driver , "add" , SHORT_TIMEOUT , true ) ;
@@ -289,12 +361,12 @@ const benchReadyMemory = new class extends Benchmark {
289361const benchRunMemory = new class extends Benchmark {
290362 constructor ( ) {
291363 super ( {
292- id : "22_run-memory" ,
293- label : "run memory" ,
294- description : "Memory usage after adding 1000 rows." ,
295- type : BenchmarkType . MEM ,
296- allowBatching : false
297- } )
364+ id : BENCHMARK_22 ,
365+ label : "run memory" ,
366+ description : "Memory usage after adding 1000 rows." ,
367+ type : BenchmarkType . MEM ,
368+ allowBatching : false ,
369+ } ) ;
298370 }
299371 async init ( driver : WebDriver ) {
300372 await testElementLocatedById ( driver , "add" , SHORT_TIMEOUT , true ) ;
@@ -308,12 +380,12 @@ const benchRunMemory = new class extends Benchmark {
308380const benchUpdate5Memory = new class extends Benchmark {
309381 constructor ( ) {
310382 super ( {
311- id : "23_update5-memory" ,
312- label : "update eatch 10th row for 1k rows (5 cycles)" ,
313- description : "Memory usage after clicking update every 10th row 5 times" ,
314- type : BenchmarkType . MEM ,
315- allowBatching : false
316- } )
383+ id : BENCHMARK_23 ,
384+ label : "update eatch 10th row for 1k rows (5 cycles)" ,
385+ description : "Memory usage after clicking update every 10th row 5 times" ,
386+ type : BenchmarkType . MEM ,
387+ allowBatching : false ,
388+ } ) ;
317389 }
318390 async init ( driver : WebDriver ) {
319391 await testElementLocatedById ( driver , "add" , SHORT_TIMEOUT , true ) ;
@@ -330,12 +402,12 @@ const benchUpdate5Memory = new class extends Benchmark {
330402const benchReplace5Memory = new class extends Benchmark {
331403 constructor ( ) {
332404 super ( {
333- id : "24_run5-memory" ,
334- label : "replace 1k rows (5 cycles)" ,
335- description : "Memory usage after clicking create 1000 rows 5 times" ,
336- type : BenchmarkType . MEM ,
337- allowBatching : false
338- } )
405+ id : BENCHMARK_24 ,
406+ label : "replace 1k rows (5 cycles)" ,
407+ description : "Memory usage after clicking create 1000 rows 5 times" ,
408+ type : BenchmarkType . MEM ,
409+ allowBatching : false ,
410+ } ) ;
339411 }
340412 async init ( driver : WebDriver ) {
341413 await testElementLocatedById ( driver , "add" , SHORT_TIMEOUT , true ) ;
@@ -351,12 +423,12 @@ const benchReplace5Memory = new class extends Benchmark {
351423const benchCreateClear5Memory = new class extends Benchmark {
352424 constructor ( ) {
353425 super ( {
354- id : "25_run-clear-memory" ,
355- label : "creating/clearing 1k rows (5 cycles)" ,
356- description : "Memory usage after creating and clearing 1000 rows 5 times" ,
357- type : BenchmarkType . MEM ,
358- allowBatching : false
359- } )
426+ id : BENCHMARK_25 ,
427+ label : "creating/clearing 1k rows (5 cycles)" ,
428+ description : "Memory usage after creating and clearing 1000 rows 5 times" ,
429+ type : BenchmarkType . MEM ,
430+ allowBatching : false ,
431+ } ) ;
360432 }
361433 async init ( driver : WebDriver ) {
362434 await testElementLocatedById ( driver , "add" , SHORT_TIMEOUT , true ) ;
@@ -372,7 +444,7 @@ const benchCreateClear5Memory = new class extends Benchmark {
372444}
373445
374446const benchStartupConsistentlyInteractive : StartupBenchmarkResult = {
375- id : "31_startup-ci" ,
447+ id : BENCHMARK_31 ,
376448 label : "consistently interactive" ,
377449 description : "a pessimistic TTI - when the CPU and network are both definitely very idle. (no more CPU tasks over 50ms)" ,
378450 type : BenchmarkType . STARTUP ,
@@ -387,7 +459,7 @@ const benchStartupBootup: StartupBenchmarkResult = {
387459 type : BenchmarkType . STARTUP ,
388460 property : "ScriptBootUpTtime" ,
389461 allowBatching : false
390- }
462+ }
391463
392464const benchStartupMainThreadWorkCost : StartupBenchmarkResult = {
393465 id : "33_startup-mainthreadcost" ,
0 commit comments