Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d9c3b5b
Added `hoverable` config property
suresh-gangumalla Apr 7, 2026
baba0ec
Marking component as non-interactive based on hover/unhover
suresh-gangumalla Apr 15, 2026
6fdcd57
Addressed review comments
suresh-gangumalla Apr 16, 2026
a7bbec4
Detecting $isHovered from template
suresh-gangumalla Apr 23, 2026
cde97bf
Handled $isHovered and this.$isHovered
suresh-gangumalla Apr 24, 2026
0e08352
fix: improve precompiler hover state detection
uguraslan Apr 28, 2026
42b1ae6
Merge pull request #16 from uguraslan/feat/precompiler-hover-detection
suresh-gangumalla Apr 28, 2026
12264e3
Added support for / fixed using computed props in forloops (fully rea…
michielvandergeest Oct 26, 2026
773b1dd
Added benchmark for measuring component creation.
michielvandergeest Oct 27, 2026
a57d94b
Added --all option to run all benchmarks.
michielvandergeest Oct 27, 2026
da91f4c
Updated GH workflow runner of benchmarks to handle all benchmarks.
michielvandergeest Oct 27, 2026
f7257cb
Added short param and cpu-slowdown param. Increased warmup to 20 in a…
michielvandergeest Oct 27, 2026
90ab1ba
Added 20x warmup for GH workflow script.
michielvandergeest Oct 27, 2026
4492d05
Cleanup up benchmark report.
michielvandergeest Oct 27, 2026
a8c8dc8
Merge pull request #825 from lightning-js/feature/component-creation-…
michielvandergeest Oct 27, 2026
0877776
Moved abstraction of renderer and blits version for logging to vite p…
michielvandergeest Oct 29, 2026
ebb1bf1
Improved benchmark comparison reporting (using 95% intervals) and run…
michielvandergeest Oct 29, 2026
69c8219
Bump magic-string from 1.4.3 to 1.4.4
dependabot[bot] Oct 29, 2026
e133b60
Bump @lightningjs/renderer from 3.7.0 to 3.8.0
dependabot[bot] Oct 29, 2026
6afa296
Updated pairs to 8. Changed GH workflow to run at 6x slowdown.
michielvandergeest Oct 29, 2026
cf9b8c1
Disabled automatic runs of benchmark in the CI (as we can't really ge…
michielvandergeest Oct 29, 2026
cfebddf
Merge pull request #830 from lightning-js/feature/improve-benchmark-c…
michielvandergeest Oct 29, 2026
a60b262
Merge branch 'dev' into feature/computed-forloop
michielvandergeest Oct 29, 2026
d1339d3
Added 2 benchmarks for evaluating computed.
michielvandergeest Oct 29, 2026
d201062
Merge pull request #829 from lightning-js/refactor/improved-version-l…
michielvandergeest Oct 30, 2026
7786775
Merge pull request #831 from lightning-js/dependabot/npm_and_yarn/dev…
michielvandergeest Oct 30, 2026
51a5c41
Merge pull request #832 from lightning-js/dependabot/npm_and_yarn/dev…
michielvandergeest Oct 30, 2026
3ac0e08
Fixed different test-suite related issued as raised in R #591 (withou…
michielvandergeest Oct 30, 2026
1f48ded
Improved formatting of GH comment with test results.
michielvandergeest Oct 30, 2026
b433985
Merge branch 'dev' into omit-overlay-components
michielvandergeest Oct 30, 2026
f0d16c8
Separated interactivity from holder node prop. Fixed factory resoluti…
michielvandergeest Oct 30, 2026
0f7eea2
Fixed support for mouse click when component doesn't have hover defin…
michielvandergeest Oct 30, 2026
b4953c8
Merge pull request #833 from lightning-js/feature/computed-forloop
michielvandergeest Oct 30, 2026
9c49064
Added prepare step to compile runtime components before holder creati…
michielvandergeest Oct 30, 2026
8c351a7
Addressed edge case where comment stripping could miss valid $isHover…
michielvandergeest Oct 30, 2026
825432a
Added extra tests to ensure interactivity is properly detected.
michielvandergeest Oct 30, 2026
9389631
Simplified needsInteractive logic. Eliminated defineProperty with get…
michielvandergeest Oct 30, 2026
a1a9db9
Bump magic-string from 1.4.4 to 1.4.5
dependabot[bot] Oct 30, 2026
6311f36
Merge pull request #834 from lightning-js/refactor/test-setup-improve…
michielvandergeest Nov 2, 2026
ad8763f
Merge pull request #836 from lightning-js/dependabot/npm_and_yarn/dev…
michielvandergeest Nov 2, 2026
185b04f
Added caching for computed props, triggering recalculation only when …
michielvandergeest Nov 2, 2026
234ac56
Fixed for loop reactivity tests with new computed caching.
michielvandergeest Nov 2, 2026
92dc461
Merge branch 'dev' into feature/cache-computed-props
michielvandergeest Nov 2, 2026
b91401e
Fixed issue when is-component is marked as reactive instead of only d…
michielvandergeest Nov 3, 2026
ff42c5b
Merge pull request #837 from lightning-js/feature/cache-computed-props
michielvandergeest Nov 3, 2026
c8537d7
Bumped L3 renderer to v 3.10.0.
michielvandergeest Nov 4, 2026
1896a40
Bumped version to 2.16.0 and updated changelog.
michielvandergeest Nov 4, 2026
11a1447
Merge pull request #654 from suresh-gangumalla/omit-overlay-components
michielvandergeest Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 95 additions & 50 deletions .github/scripts/publish-benchmark.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@ const marker = '<!-- blits-benchmark-results -->'
const branch = 'benchmark-reports'

module.exports = async ({ github, context, core }) => {
const { comparePairs, formatComparison } = await import('../../benchmarks/comparison.js')
const {
comparePairs,
formatComparison,
formatComparisonSuite,
formatComparisonOverview,
unsupportedReasons,
} = await import('../../benchmarks/comparison.js')
const { validateThreshold, DEFAULT_THRESHOLD_PERCENT, MIN_BLOCKS } =
await import('../../benchmarks/statistics.js')
const repo = context.repo
const run = context.payload.workflow_run
let pulls = run.pull_requests
Expand All @@ -15,6 +23,9 @@ module.exports = async ({ github, context, core }) => {
})
}
const report = JSON.parse(await readFile('benchmark-data/comparison.json', 'utf8'))
if (report.status !== undefined && report.status !== 'completed') {
throw new Error('Benchmark comparison is incomplete')
}
const prs = []
for (const pull of pulls) {
const { data: pr } = await github.rest.pulls.get({ ...repo, pull_number: pull.number })
Expand All @@ -32,57 +43,85 @@ module.exports = async ({ github, context, core }) => {
return
}

// Artifacts are untrusted data. Validate numeric inputs and escape display text.
const positiveInteger = (value) => Number.isSafeInteger(value) && value > 0 && value <= 100_000
if (
!positiveInteger(report.size) ||
!positiveInteger(report.samples) ||
!Number.isSafeInteger(report.warmup) ||
report.warmup < 0 ||
report.warmup > 100_000 ||
!Array.isArray(report.pairs) ||
!report.pairs.length ||
report.pairs.length > 100
) {
throw new Error('Invalid benchmark configuration')
const reports = Object.hasOwn(report, 'benchmarks') ? report.benchmarks : [report]
if (!Array.isArray(reports) || reports.length < 1 || reports.length > 100) {
throw new Error('Invalid benchmark suite')
}
for (const pair of report.pairs) {
for (const result of reports) {
if (
result.base?.commit !== report.base.commit ||
result.candidate?.commit !== report.candidate.commit
) {
throw new Error('Benchmark commit identities do not match the suite')
}
// Artifacts are untrusted data. Validate numeric inputs and escape display text.
const positiveInteger = (value) => Number.isSafeInteger(value) && value > 0 && value <= 100_000
if (
!Array.isArray(pair.order) ||
pair.order.length !== 2 ||
[...pair.order].sort().join(',') !== 'base,candidate'
!positiveInteger(result.size) ||
!positiveInteger(result.samples) ||
!Number.isSafeInteger(result.warmup) ||
result.warmup < 0 ||
result.warmup > 100_000 ||
!Array.isArray(result.pairs) ||
!result.pairs.length ||
result.pairs.length > 100
) {
throw new Error('Invalid benchmark execution order')
throw new Error('Invalid benchmark configuration')
}
for (const name of ['base', 'candidate']) {
for (const metric of ['medianGenerationSyncMs', 'medianTotalToIdleMs']) {
if (!Number.isFinite(pair[name]?.[metric]) || pair[name][metric] < 0) {
throw new Error('Invalid benchmark timing')
for (const pair of result.pairs) {
if (
!Array.isArray(pair.order) ||
pair.order.length !== 2 ||
[...pair.order].sort().join(',') !== 'base,candidate'
) {
throw new Error('Invalid benchmark execution order')
}
for (const name of ['base', 'candidate']) {
if (name === 'base' && pair.base?.status === 'unsupported') {
if (typeof pair.base.reason !== 'string' || !pair.base.reason.trim()) {
throw new Error('Invalid unsupported baseline reason')
}
continue
}
if (pair[name]?.status === 'unsupported') throw new Error('Candidate benchmark unsupported')
for (const metric of ['medianGenerationSyncMs', 'medianTotalToIdleMs']) {
if (!Number.isFinite(pair[name]?.[metric]) || pair[name][metric] < 0) {
throw new Error('Invalid benchmark timing')
}
}
}
}
}
const text = (value) =>
String(value)
.slice(0, 120)
.replace(/[\\`*_[\]<>|#\r\n]/g, ' ')
report.title = text(report.title)
report.browserVersion = text(report.browserVersion)
report.cpuSlowdown = 20
report.candidate.dirty = false
report.comparison = comparePairs(report.pairs)
if (
report.comparison.some(
(row) =>
!Number.isFinite(row.differenceMs) ||
(row.changePercent !== null && !Number.isFinite(row.changePercent))
const text = (value) =>
String(value)
.slice(0, 120)
.replace(/[\\`*_[\]<>|#\r\n]/g, ' ')
for (const pair of result.pairs) {
if (pair.base.status === 'unsupported') pair.base.reason = text(pair.base.reason)
}
result.title = text(result.title)
result.browserVersion = text(result.browserVersion)
result.cpuSlowdown ??= 20
if (!Number.isFinite(result.cpuSlowdown) || result.cpuSlowdown < 1) {
throw new Error('Invalid CPU slowdown')
}
result.candidate.dirty = false
result.thresholdPercent = validateThreshold(
result.thresholdPercent ?? DEFAULT_THRESHOLD_PERCENT
)
) {
throw new Error('Invalid benchmark comparison')
result.comparison = comparePairs(result.pairs, { thresholdPercent: result.thresholdPercent })
if (
result.comparison.some(
(row) =>
(row.differenceMs !== null && !Number.isFinite(row.differenceMs)) ||
(row.changePercent !== null && !Number.isFinite(row.changePercent))
)
) {
throw new Error('Invalid benchmark comparison')
}
}

const path = `runs/${run.id}-${run.run_attempt || 1}`
const markdown = `${formatComparison(report)}\n[JSON data](comparison.json) · [Workflow run](${run.html_url})\n`
const markdown = `${Object.hasOwn(report, 'benchmarks') ? formatComparisonSuite(report) : formatComparison(report)}\n[JSON data](comparison.json) · [Workflow run](${run.html_url})\n`
let parent
let baseTree
try {
Expand Down Expand Up @@ -124,20 +163,26 @@ module.exports = async ({ github, context, core }) => {
}

const url = `${context.serverUrl}/${repo.owner}/${repo.repo}/blob/${commit.sha}/${path}/report.md`
const change = (metric) => {
const value = report.comparison.find((row) => row.metric === metric).changePercent
return value === null ? 'n/a' : `${value > 0 ? '+' : ''}${value.toFixed(2)}%`
}
const body = [
marker,
'### Benchmark comparison',
'',
'| Timing | Change |',
'| --- | ---: |',
`| Synchronous generation | ${change('medianGenerationSyncMs')} |`,
`| Total time to idle | ${change('medianTotalToIdleMs')} |`,
formatComparisonOverview(reports),
'',
...reports.map(
(result) =>
`${result.title}: ±${result.thresholdPercent}% practical band; ${result.pairs.length} pairs, ${result.warmup} warmups and ${result.samples} samples per run.`
),
'',
...reports.flatMap((result) =>
unsupportedReasons(result).map(
(reason) => `${result.title}: N/A — unsupported by baseline: ${reason}`
)
),
'',
`Runs with fewer than ${MIN_BLOCKS} balanced blocks (${MIN_BLOCKS * 2} pairs) are preliminary; no confidence interval or performance conclusion is available.`,
'',
'Negative means faster. Informational results; small changes can be measurement noise.',
'Negative means faster. Intervals and verdicts use balanced launch blocks, not inner samples. Inconclusive is not evidence of no change. Results are informational.',
'',
`[Full report](${url}) · [Workflow run](${run.html_url})`,
'',
Expand Down
181 changes: 179 additions & 2 deletions .github/scripts/publish-benchmark.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
await rm(directory, { recursive: true, force: true })
})

const fixture = async ({ existing = false, stale = false, invalid = false } = {}) => {
const fixture = async ({
existing = false,
stale = false,
invalid = false,
suite = false,
mutate,
} = {}) => {
const calls = []
const report = {
title: 'Element generation benchmark',
Expand All @@ -38,7 +44,22 @@
],
comparison: [{ changePercent: 999 }], // Recomputed rather than trusted.
}
await writeFile('benchmark-data/comparison.json', JSON.stringify(report))
const data = suite
? {
base: report.base,
candidate: report.candidate,
benchmarks: [
{ ...report, benchmark: 'element-creation' },
{
...structuredClone(report),
benchmark: 'component-creation',
title: 'Component generation benchmark',
},
],
}
: report
mutate?.(data)
await writeFile('benchmark-data/comparison.json', JSON.stringify(data))
const method = (name, data) => async (args) => {
calls.push({ name, args })
return { data }
Expand Down Expand Up @@ -137,3 +158,159 @@
await assert.rejects(publish(invalid), /Invalid benchmark timing/)
assert.ok(!invalid.calls.some((call) => call.name === 'createTree'))
})

test('publishes every benchmark with individual comparisons and run configuration', async () => {
const mock = await fixture({ suite: true })
await publish(mock)
const body = mock.calls.find((call) => call.name === 'createComment').args.body
assert.match(body, /Benchmark \| Generation change \| Time to idle change/)
assert.match(body, /Element generation benchmark \| -20\.00% · Preliminary \| \+10\.00%/)
assert.match(body, /Component generation benchmark \| -20\.00% · Preliminary \| \+10\.00%/)
assert.match(body, /1 pairs, 5 warmups and 20 samples/)
const tree = mock.calls.find((call) => call.name === 'createTree').args.tree
assert.match(tree[0].content, /## Element generation benchmark: comparison/)
assert.match(tree[0].content, /## Component generation benchmark: comparison/)
const saved = JSON.parse(tree[1].content)
assert.equal(saved.benchmarks.length, 2)
assert.ok(Math.abs(saved.benchmarks[1].comparison[0].changePercent + 20) < 1e-10)
})

test('rejects invalid suite entries before writing reports or comments', async () => {
for (const [mutate, expected] of [
[
(report) => {
report.status = 'running'
},
/comparison is incomplete/,
],
[
(report) => {
report.status = 'failed'
},
/comparison is incomplete/,
],
[
(report) => {
report.benchmarks = []
},
/Invalid benchmark suite/,
],
[
(report) => {
report.benchmarks[1].pairs[0].candidate.medianTotalToIdleMs = -1
},
/Invalid benchmark timing/,
],
[
(report) => {
report.benchmarks[1].candidate.commit = 'different'
},
/commit identities/,
],
]) {
const mock = await fixture({ suite: true, mutate })
await assert.rejects(publish(mock), expected)
assert.ok(
!mock.calls.some((call) =>
['createTree', 'createComment', 'updateComment'].includes(call.name)
)
)
}
})

test('escapes suite titles before rendering comment tables and report sections', async () => {
const mock = await fixture({
suite: true,
mutate: (report) => {
report.benchmarks[1].title = '<script>|injected\nrow'
},
})
await publish(mock)
const body = mock.calls.find((call) => call.name === 'createComment').args.body
assert.doesNotMatch(body, /<script>|injected\nrow/)
Comment thread
michielvandergeest marked this conversation as resolved.
Dismissed
})

test('publishes N/A for explicitly unsupported baselines with candidate timings and escaped reasons', async () => {
const mock = await fixture({
suite: true,
mutate: (report) => {
report.benchmarks[1].pairs[0].base = {
status: 'unsupported',
reason: 'Requires <new> API|test',
}
},
})
await publish(mock)
const body = mock.calls.find((call) => call.name === 'createComment').args.body
assert.match(body, /Component generation benchmark \| N\/A \| N\/A/)
assert.match(body, /unsupported by baseline: Requires {2}new {2}API test/)
const tree = mock.calls.find((call) => call.name === 'createTree').args.tree
assert.match(tree[0].content, /N\/A \| 80\.00 \| N\/A/)
const report = JSON.parse(tree[1].content)
assert.equal(report.benchmarks[1].comparison[0].candidateMs, 80)
})

test('rejects unsupported candidates and unsupported baselines without explicit reasons', async () => {
for (const [side, reason, expected] of [
['candidate', 'Requires feature X', /Candidate benchmark unsupported/],
['base', '', /Invalid unsupported baseline reason/],
]) {
const mock = await fixture({
suite: true,
mutate: (report) => {
report.benchmarks[1].pairs[0][side] = { status: 'unsupported', reason }
},
})
await assert.rejects(publish(mock), expected)
assert.ok(!mock.calls.some((call) => call.name === 'createTree'))
}
})

test('preserves the measured CPU rate and rejects invalid rates', async () => {
const mock = await fixture({
mutate: (report) => {
report.cpuSlowdown = 4
},
})
await publish(mock)
const tree = mock.calls.find((call) => call.name === 'createTree').args.tree
assert.match(tree[0].content, /CPU slowdown \| 4×/)
assert.equal(JSON.parse(tree[1].content).cpuSlowdown, 4)
const invalid = await fixture({
mutate: (report) => {
report.cpuSlowdown = 0
},
})
await assert.rejects(publish(invalid), /Invalid CPU slowdown/)
})

test('recomputes intervals and verdicts rather than trusting artifact claims', async () => {
const mock = await fixture({
mutate: (report) => {
const pair = report.pairs[0]
report.pairs = Array.from({ length: 8 }, (_, index) => ({
...structuredClone(pair),
order: index % 2 ? ['candidate', 'base'] : ['base', 'candidate'],
}))
report.comparison = [
{ changePercent: 999, verdict: 'equivalent', intervalPercent: { lower: 0, upper: 0 } },
]
},
})
await publish(mock)
const body = mock.calls.find((call) => call.name === 'createComment').args.body
assert.match(body, /Improvement/)
assert.match(body, /Regression/)
assert.doesNotMatch(body, /999|No meaningful change/)
const json = JSON.parse(
mock.calls.find((call) => call.name === 'createTree').args.tree[1].content
)
assert.equal(json.comparison[0].verdict, 'improved')
assert.equal(json.comparison[0].independentBlocks, 4)
const invalid = await fixture({
mutate: (report) => {
report.thresholdPercent = -1
},
})
await assert.rejects(publish(invalid), /Threshold must/)
})
Loading
Loading