Skip to content

Commit c60ca72

Browse files
authored
chore: add runtime report (#6592)
1 parent c0b31bf commit c60ca72

13 files changed

Lines changed: 1569 additions & 44 deletions

test/end-to-end/benchmark-compile-time.js

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
const fs = require('fs');
22
const path = require('path');
3-
const { execSync, spawnSync } = require('child_process');
3+
const { spawnSync } = require('child_process');
44

55
const COLD_RUNS = 5;
66
const WARM_RUNS = 5;
77
const STENCIL_BIN = path.join(__dirname, '..', '..', 'bin', 'stencil');
88
const CACHE_DIR = path.join(__dirname, '.stencil');
99
const RESULTS_FILE = path.join(__dirname, 'benchmark-results.json');
10+
const SUMMARY_FILE = path.join(__dirname, 'benchmark-results.md');
1011

1112
function clearCache() {
1213
if (fs.existsSync(CACHE_DIR)) {
@@ -64,6 +65,57 @@ function printStats(label, stats) {
6465
console.log(` StdDev: ${formatMs(stats.stddev)}`);
6566
}
6667

68+
function generateMarkdown(results, history) {
69+
const { cold, warm } = results;
70+
71+
const fmtValue = (ms) => formatMs(ms).padStart(8);
72+
73+
let md = `# Stencil Compile Time Benchmark
74+
75+
**Last Run:** ${results.timestamp}
76+
**Node:** ${results.nodeVersion} | **Platform:** ${results.platform} (${results.arch})
77+
78+
## Latest Results
79+
80+
### Cold Builds (no cache)
81+
82+
| Metric | Value |
83+
|----------|----------|
84+
| Min | ${fmtValue(cold.min)} |
85+
| Max | ${fmtValue(cold.max)} |
86+
| **Avg** | **${formatMs(cold.avg)}** |
87+
| Median | ${fmtValue(cold.median)} |
88+
| StdDev | ${fmtValue(cold.stddev)} |
89+
90+
### Warm Builds (with cache)
91+
92+
| Metric | Value |
93+
|----------|----------|
94+
| Min | ${fmtValue(warm.min)} |
95+
| Max | ${fmtValue(warm.max)} |
96+
| **Avg** | **${formatMs(warm.avg)}** |
97+
| Median | ${fmtValue(warm.median)} |
98+
| StdDev | ${fmtValue(warm.stddev)} |
99+
100+
## History
101+
102+
| Date | Cold Avg | Warm Avg | Node |
103+
|------------|----------|----------|----------|
104+
`;
105+
106+
// Add history rows (most recent first, limit to 10)
107+
const recentHistory = [...history].reverse().slice(0, 10);
108+
for (const entry of recentHistory) {
109+
const date = new Date(entry.timestamp).toLocaleDateString().padEnd(10);
110+
const coldAvg = formatMs(entry.cold.avg).padStart(8);
111+
const warmAvg = formatMs(entry.warm.avg).padStart(8);
112+
const node = entry.nodeVersion.padEnd(8);
113+
md += `| ${date} | ${coldAvg} | ${warmAvg} | ${node} |\n`;
114+
}
115+
116+
return md;
117+
}
118+
67119
async function main() {
68120
console.log('Stencil Compilation Time Benchmark');
69121
console.log('===================================');
@@ -127,9 +179,15 @@ async function main() {
127179

128180
history.push(results);
129181

182+
// Save JSON
130183
fs.writeFileSync(RESULTS_FILE, JSON.stringify({ latest: results, history }, null, 2));
131184

132-
console.log(`\nResults saved to ${RESULTS_FILE}`);
185+
// Save Markdown summary
186+
fs.writeFileSync(SUMMARY_FILE, generateMarkdown(results, history));
187+
188+
console.log(`\nResults saved to:`);
189+
console.log(` ${RESULTS_FILE}`);
190+
console.log(` ${SUMMARY_FILE}`);
133191
}
134192

135193
main().catch((err) => {

test/end-to-end/benchmark-results.json

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
11
{
22
"latest": {
3-
"timestamp": "2026-02-06T21:45:03.487Z",
3+
"timestamp": "2026-02-06T23:01:42.644Z",
44
"nodeVersion": "v22.2.0",
55
"platform": "darwin",
66
"arch": "x64",
77
"cold": {
88
"runs": [
9-
37947.799478,
10-
40695.147218000006,
11-
38215.94856600001,
12-
36807.719572999995,
13-
38792.325721
9+
34351.170047,
10+
33631.484595,
11+
33792.84220999999,
12+
33212.284922000006,
13+
36396.31289599999
1414
],
15-
"min": 36807.719572999995,
16-
"max": 40695.147218000006,
17-
"avg": 38491.7881112,
18-
"stddev": 1276.96610272355,
19-
"median": 38215.94856600001
15+
"min": 33212.284922000006,
16+
"max": 36396.31289599999,
17+
"avg": 34276.818933999995,
18+
"stddev": 1120.866208263047,
19+
"median": 33792.84220999999
2020
},
2121
"warm": {
2222
"runs": [
23-
27531.916141000023,
24-
25359.006583999988,
25-
27169.449844999996,
26-
26921.043767999974,
27-
26809.90310699999
23+
25229.430728999985,
24+
24570.14856,
25+
24362.824242000002,
26+
25592.336630999984,
27+
24989.860770999978
2828
],
29-
"min": 25359.006583999988,
30-
"max": 27531.916141000023,
31-
"avg": 26758.263888999994,
32-
"stddev": 742.2528680813745,
33-
"median": 26921.043767999974
29+
"min": 24362.824242000002,
30+
"max": 25592.336630999984,
31+
"avg": 24948.92018659999,
32+
"stddev": 443.0177012640996,
33+
"median": 24989.860770999978
3434
}
3535
},
3636
"history": [
3737
{
38-
"timestamp": "2026-02-06T21:45:03.487Z",
38+
"timestamp": "2026-02-06T23:01:42.644Z",
3939
"nodeVersion": "v22.2.0",
4040
"platform": "darwin",
4141
"arch": "x64",
4242
"cold": {
4343
"runs": [
44-
37947.799478,
45-
40695.147218000006,
46-
38215.94856600001,
47-
36807.719572999995,
48-
38792.325721
44+
34351.170047,
45+
33631.484595,
46+
33792.84220999999,
47+
33212.284922000006,
48+
36396.31289599999
4949
],
50-
"min": 36807.719572999995,
51-
"max": 40695.147218000006,
52-
"avg": 38491.7881112,
53-
"stddev": 1276.96610272355,
54-
"median": 38215.94856600001
50+
"min": 33212.284922000006,
51+
"max": 36396.31289599999,
52+
"avg": 34276.818933999995,
53+
"stddev": 1120.866208263047,
54+
"median": 33792.84220999999
5555
},
5656
"warm": {
5757
"runs": [
58-
27531.916141000023,
59-
25359.006583999988,
60-
27169.449844999996,
61-
26921.043767999974,
62-
26809.90310699999
58+
25229.430728999985,
59+
24570.14856,
60+
24362.824242000002,
61+
25592.336630999984,
62+
24989.860770999978
6363
],
64-
"min": 25359.006583999988,
65-
"max": 27531.916141000023,
66-
"avg": 26758.263888999994,
67-
"stddev": 742.2528680813745,
68-
"median": 26921.043767999974
64+
"min": 24362.824242000002,
65+
"max": 25592.336630999984,
66+
"avg": 24948.92018659999,
67+
"stddev": 443.0177012640996,
68+
"median": 24989.860770999978
6969
}
7070
}
7171
]
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Stencil Compile Time Benchmark
2+
3+
**Last Run:** 2026-02-06T23:01:42.644Z
4+
**Node:** v22.2.0 | **Platform:** darwin (x64)
5+
6+
## Latest Results
7+
8+
### Cold Builds (no cache)
9+
10+
| Metric | Value |
11+
|----------|----------|
12+
| Min | 33.21s |
13+
| Max | 36.40s |
14+
| **Avg** | **34.28s** |
15+
| Median | 33.79s |
16+
| StdDev | 1.12s |
17+
18+
### Warm Builds (with cache)
19+
20+
| Metric | Value |
21+
|----------|----------|
22+
| Min | 24.36s |
23+
| Max | 25.59s |
24+
| **Avg** | **24.95s** |
25+
| Median | 24.99s |
26+
| StdDev | 0.44s |
27+
28+
## History
29+
30+
| Date | Cold Avg | Warm Avg | Node |
31+
|------------|----------|----------|----------|
32+
| 2/6/2026 | 34.28s | 24.95s | v22.2.0 |

0 commit comments

Comments
 (0)