Skip to content

Commit bab2edb

Browse files
authored
Bench: Amplify five short template benches 50→500 cycles to clear noise floor (#192)
1 parent 039c9dd commit bab2edb

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

packages/component/bench/tachometer/bench-template.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -357,41 +357,41 @@ async function mount(tagName) {
357357
*******************************/
358358

359359
const el1 = await mount('bench-reactivedata');
360-
// purpose: Mutates one verbose reactiveData field across 100 child subtemplates. Only the changed field re-evaluates.
361-
performance.mark(startMark('subtemplate-reactive-data-100'));
362-
for (let i = 0; i < 50; i++) {
360+
// purpose: Mutates one verbose reactiveData field across 100 child subtemplates, 500 cycles. Only the changed field re-evaluates.
361+
performance.mark(startMark('subtemplate-reactive-data-100x500'));
362+
for (let i = 0; i < 500; i++) {
363363
el1.template.state.labelVal.set(`v${i}`);
364364
flushWork();
365365
}
366-
performance.measure('subtemplate-reactive-data-100', startMark('subtemplate-reactive-data-100'));
366+
performance.measure('subtemplate-reactive-data-100x500', startMark('subtemplate-reactive-data-100x500'));
367367
destroy();
368368

369369
/*******************************
370370
Subtemplate shorthand props
371371
*******************************/
372372

373373
const el2 = await mount('bench-shorthand');
374-
// purpose: Mutates one shorthand prop's source across 100 child subtemplates. Only that prop re-evaluates.
375-
performance.mark(startMark('subtemplate-shorthand-props-100'));
376-
for (let i = 0; i < 50; i++) {
374+
// purpose: Mutates one shorthand prop's source across 100 child subtemplates, 500 cycles. Only that prop re-evaluates.
375+
performance.mark(startMark('subtemplate-shorthand-props-100x500'));
376+
for (let i = 0; i < 500; i++) {
377377
el2.template.state.labelVal.set(`v${i}`);
378378
flushWork();
379379
}
380-
performance.measure('subtemplate-shorthand-props-100', startMark('subtemplate-shorthand-props-100'));
380+
performance.measure('subtemplate-shorthand-props-100x500', startMark('subtemplate-shorthand-props-100x500'));
381381
destroy();
382382

383383
/*******************************
384384
Snippet args
385385
*******************************/
386386

387387
const el3 = await mount('bench-snippet');
388-
// purpose: Mutates one snippet arg's source across 100 invocations. Adjacent no-signal expressions stay quiet.
389-
performance.mark(startMark('snippet-args-per-key-100'));
390-
for (let i = 0; i < 50; i++) {
388+
// purpose: Mutates one snippet arg's source across 100 invocations, 500 cycles. Adjacent no-signal expressions stay quiet.
389+
performance.mark(startMark('snippet-args-per-key-100x500'));
390+
for (let i = 0; i < 500; i++) {
391391
el3.template.state.labelVal.set(`v${i}`);
392392
flushWork();
393393
}
394-
performance.measure('snippet-args-per-key-100', startMark('snippet-args-per-key-100'));
394+
performance.measure('snippet-args-per-key-100x500', startMark('snippet-args-per-key-100x500'));
395395
destroy();
396396

397397
/*******************************
@@ -473,27 +473,27 @@ destroy();
473473
*******************************/
474474

475475
const el11 = await mount('bench-realistic-light');
476-
// purpose: 100 subtemplates, 4 inner bindings each calling formatDate / classIf / capitalize. Mutates one source signal — under per-key isolation, only the title binding's evaluator runs; without it, all four helpers re-fire per child on every cycle.
477-
performance.mark(startMark('subtemplate-helpers-light-100'));
478-
for (let i = 0; i < 50; i++) {
476+
// purpose: 100 subtemplates, 4 inner bindings each calling formatDate / classIf / capitalize, 500 cycles. Mutates one source signal — under per-key isolation, only the title binding's evaluator runs; without it, all four helpers re-fire per child on every cycle.
477+
performance.mark(startMark('subtemplate-helpers-light-100x500'));
478+
for (let i = 0; i < 500; i++) {
479479
el11.template.state.titleVal.set(`title-${i}`);
480480
flushWork();
481481
}
482-
performance.measure('subtemplate-helpers-light-100', startMark('subtemplate-helpers-light-100'));
482+
performance.measure('subtemplate-helpers-light-100x500', startMark('subtemplate-helpers-light-100x500'));
483483
destroy();
484484

485485
/*******************************
486486
Realistic helpers — heavy
487487
*******************************/
488488

489489
const el12 = await mount('bench-realistic-heavy');
490-
// purpose: 100 subtemplates, 4 inner bindings where three call helpers shaped like userland reality — Intl.NumberFormat, Array.find against a 50-item lookup table, snake_case → Title Case string transform, taxRules iteration. Mutates titleVal only; per-key isolation should keep the three heavy helpers asleep.
491-
performance.mark(startMark('subtemplate-helpers-heavy-100'));
492-
for (let i = 0; i < 50; i++) {
490+
// purpose: 100 subtemplates, 4 inner bindings where three call helpers shaped like userland reality — Intl.NumberFormat, Array.find against a 50-item lookup table, snake_case → Title Case string transform, taxRules iteration, 500 cycles. Mutates titleVal only; per-key isolation should keep the three heavy helpers asleep.
491+
performance.mark(startMark('subtemplate-helpers-heavy-100x500'));
492+
for (let i = 0; i < 500; i++) {
493493
el12.template.state.titleVal.set(`title-${i}`);
494494
flushWork();
495495
}
496-
performance.measure('subtemplate-helpers-heavy-100', startMark('subtemplate-helpers-heavy-100'));
496+
performance.measure('subtemplate-helpers-heavy-100x500', startMark('subtemplate-helpers-heavy-100x500'));
497497
destroy();
498498

499499
/*******************************

packages/component/bench/tachometer/tachometer-ci-template.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
"url": "ci-current-template.html",
1111
"browser": { "name": "chrome", "headless": true },
1212
"measurement": [
13-
{ "mode": "performance", "entryName": "subtemplate-reactive-data-100" },
14-
{ "mode": "performance", "entryName": "subtemplate-shorthand-props-100" },
15-
{ "mode": "performance", "entryName": "snippet-args-per-key-100" },
13+
{ "mode": "performance", "entryName": "subtemplate-reactive-data-100x500" },
14+
{ "mode": "performance", "entryName": "subtemplate-shorthand-props-100x500" },
15+
{ "mode": "performance", "entryName": "snippet-args-per-key-100x500" },
1616
{ "mode": "performance", "entryName": "active-indicator-200" },
1717
{ "mode": "performance", "entryName": "stable-ref-mutate-500" },
1818
{ "mode": "performance", "entryName": "subtemplate-data-blob-100" },
1919
{ "mode": "performance", "entryName": "snippet-in-subtemplate-100x1k" },
2020
{ "mode": "performance", "entryName": "active-indicator-nested-200" },
21-
{ "mode": "performance", "entryName": "subtemplate-helpers-light-100" },
22-
{ "mode": "performance", "entryName": "subtemplate-helpers-heavy-100" },
21+
{ "mode": "performance", "entryName": "subtemplate-helpers-light-100x500" },
22+
{ "mode": "performance", "entryName": "subtemplate-helpers-heavy-100x500" },
2323
{ "mode": "performance", "entryName": "each-mount-1000" }
2424
]
2525
},
@@ -28,16 +28,16 @@
2828
"url": "ci-baseline-template.html",
2929
"browser": { "name": "chrome", "headless": true },
3030
"measurement": [
31-
{ "mode": "performance", "entryName": "subtemplate-reactive-data-100" },
32-
{ "mode": "performance", "entryName": "subtemplate-shorthand-props-100" },
33-
{ "mode": "performance", "entryName": "snippet-args-per-key-100" },
31+
{ "mode": "performance", "entryName": "subtemplate-reactive-data-100x500" },
32+
{ "mode": "performance", "entryName": "subtemplate-shorthand-props-100x500" },
33+
{ "mode": "performance", "entryName": "snippet-args-per-key-100x500" },
3434
{ "mode": "performance", "entryName": "active-indicator-200" },
3535
{ "mode": "performance", "entryName": "stable-ref-mutate-500" },
3636
{ "mode": "performance", "entryName": "subtemplate-data-blob-100" },
3737
{ "mode": "performance", "entryName": "snippet-in-subtemplate-100x1k" },
3838
{ "mode": "performance", "entryName": "active-indicator-nested-200" },
39-
{ "mode": "performance", "entryName": "subtemplate-helpers-light-100" },
40-
{ "mode": "performance", "entryName": "subtemplate-helpers-heavy-100" },
39+
{ "mode": "performance", "entryName": "subtemplate-helpers-light-100x500" },
40+
{ "mode": "performance", "entryName": "subtemplate-helpers-heavy-100x500" },
4141
{ "mode": "performance", "entryName": "each-mount-1000" }
4242
]
4343
}

0 commit comments

Comments
 (0)