Skip to content

Investigate homepage Lighthouse LCP threshold and budget aggregation #163

Description

@spizeck

Problem

The simulated-mobile Lighthouse performance check is now showing the homepage consistently around the current hard LCP threshold, and the pass/fail behavior is not obviously consistent with the summary line.

Recent CI examples:

The difference between these runs is only tens of milliseconds. PR #162 does not change homepage rendering, layout, images, or normal-path bundle behavior, so the Turbopack bootstrap patch is not a credible explanation for the regression.

The homepage also carries warning-level pressure:

  • JS ~273 KB vs 260 KB warn budget
  • total transfer ~774 KB vs 700 KB warn budget
  • image transfer ~232 KB

Goal

Determine:

  1. exactly how scripts/perf-baseline.mjs aggregates the 3 Lighthouse runs per route,
  2. why a displayed homepage LCP of 4676 ms could pass while 4693/4712 ms fail,
  3. whether the hard LCP budget is evaluating median, max, mean, a different run, or another derived value,
  4. whether the homepage is genuinely regressing or simply living too close to the threshold,
  5. whether the correct fix is test logic, performance optimization, budget calibration, or some combination.

Do not weaken the 4500 ms budget until the current behavior is understood.

Investigation

Inspect:

  • scripts/perf-baseline.mjs
  • performance-budget configuration
  • Lighthouse invocation/config
  • all 3 per-route run values, not only the summary line
  • aggregation method for score/LCP/TBT/bytes
  • pass/fail calculation
  • rounding behavior
  • retry/rerun behavior
  • whether output summary and enforcement use the same statistic
  • whether one run can be discarded or treated differently
  • whether cold/warm cache state differs between repetitions
  • whether CI container/resource contention explains the spread
  • whether recent master/PR runs show the same homepage LCP distribution

Use recent GitHub Actions artifacts/logs where useful.

Homepage performance analysis

Separately profile the homepage to identify its actual LCP element and major contributors.

At minimum determine:

  • exact LCP element
  • image dimensions/format/priority/loading behavior
  • preload/fetch priority behavior
  • whether hero image decoding/loading dominates
  • JS execution contribution
  • font contribution
  • any render-blocking CSS/script behavior
  • whether Sentry adds measurable startup cost
  • whether the homepage-specific JS/total-byte warnings point to a real optimization opportunity
  • whether recent changes shifted the baseline

Do not optimize unrelated pages in this issue unless the same root cause directly applies.

Important boundaries

Desired outcome

Produce an evidence-based recommendation for one of these paths:

A. Script/aggregation bug

Fix the performance-budget script so displayed metrics and enforcement use the same clearly documented statistic.

B. Real homepage performance issue

Implement a focused homepage optimization with measurable before/after results.

C. Threshold too close to normal variance

Only if supported by enough baseline data, propose a calibrated threshold or statistical method that still catches real regressions without turning normal CI variance into noise.

D. Combination

If both script logic and homepage performance need work, separate the fixes clearly and keep changes scoped.

Validation

If code changes are justified:

  • create a focused branch and PR
  • do not merge
  • run the performance job repeatedly
  • compare against current master
  • report all 3 run values per route for the homepage
  • run the normal repo validation
  • ensure no unrelated regressions

For a flake/variance fix, a single green run is not enough. Demonstrate stability across repeated runs.

Acceptance criteria

  • Current 4676-pass vs 4693/4712-fail behavior is explained precisely.
  • Aggregation/enforcement logic is documented.
  • Homepage LCP element and dominant costs are identified.
  • Master-vs-branch comparison is made.
  • No threshold weakening without evidence.
  • Any code change has measurable before/after data.
  • CI behavior becomes understandable and intentional.

Final report

Report:

  1. exact current aggregation method
  2. exact reason 4676 ms passed while later ~4.7 s runs failed
  3. per-run homepage LCP values from representative runs
  4. LCP element
  5. major contributors
  6. whether this is primarily test logic, real performance, variance, or a combination
  7. whether Sentry contributes materially
  8. recommended remediation
  9. code changes made, if any
  10. before/after Lighthouse results
  11. repeated-run stability results
  12. PR number/head SHA if created
  13. whether the 4500 ms budget changed, and why
  14. any follow-up issue warranted

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions