How would you track down an intermittent delay before first paint?

November 18, 2026 5 answers
Asked by 3m!ferrulegauge_826

I'm comparing the same page in React and Astro with mobile Lighthouse. Some runs paint quickly, while others stay blank for roughly 900 ms after DOMContentLoaded, even though the CSS and preloaded fonts have finished.

I don't see a long renderer main-thread task spanning the gap, and paint to DrawFrame takes only about 10 to 13 ms once painting starts. How can I separate a page issue from browser scheduling or the test environment, and what should I look for in traces?

Answers

7g~vexlori_583

Start with a control page served from the same environment. Make it plain HTML with a little inline CSS and no JavaScript, then run it repeatedly alongside both versions of the real page. Alternate the order rather than running all of one version first.

If the control also has the blank gap, that makes a shared browser or test environment issue more plausible. If only the real page does, strip features from it in stages. Neither result proves the cause, but it gives you a much smaller search space.

Keep the individual traces and compare the distribution of fast and slow runs. A matched pair is interesting, but it can't show how often the delay occurs or whether the two implementations behave differently.

3m!ferrulegauge_826:

Would you keep the same mobile throttling for the control?

_e46!copperwicket.3:

Yes, for the first comparison. Then try a separate set without throttling to see whether the pattern changes.

Reply to this answer
5n!zorliva_418

I'd recapture fast and slow runs with the same expanded trace categories. Include the categories that expose scheduler and compositor activity, then check for begin-frame scheduling, deferred main frames, commits and frame submission around the blank interval. The exact category and event names can vary by Chrome version.

The fast traces already have Scheduler::SetDeferBeginMainFrame events, but the slow traces don't include them. That's a capture difference, not evidence that scheduling differed. Look at the browser, renderer and compositor tracks together, and check whether the renderer was waiting or doing short bursts of work that don't register as a long task.

Also keep observed trace timings separate from Lighthouse's simulated FCP. The short paint-to-DrawFrame interval says the later part was quick, but it doesn't establish why the first paint was late or rule out page behavior.

Reply to this answer
q.726+gasketwicket

DOMContentLoaded isn't a guarantee that the page is visually ready. Async scripts can still run afterward, and client-rendered content, visibility styles or reveal logic can keep useful content off screen. Check what is actually in the DOM and what computed styles apply during the gap.

Try removing hydration and reveal effects separately, rather than assuming all JavaScript is the culprit. A single normal-motion versus reduced-motion pair that both happened to be fast doesn't tell you much about an intermittent delay.

Reply to this answer
Nexlavo-3r

CSS is worth testing, but I wouldn't inline every stylesheet based on these numbers. Stylesheets can block rendering, yet the reported slow runs have already finished loading them well before first paint.

As an experiment, compare a minimal page with inline critical styles against the same styles in an external file. That can show whether the stylesheet path matters without treating a bigger HTML document as an automatic fix.

Reply to this answer
_w35+quavrix.9

Check the test setup too. Fresh profiles help reduce extension interference, but try headed Chrome as well as headless and note whether the machine is busy during slow runs. Run the production build through an HTTP server rather than comparing against a development server.

Change one thing at a time and repeat enough runs to catch the delay. A quick desktop run is useful context, but it doesn't rule out something specific to the mobile test configuration.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions