Skip to content

@ogygia/devtools · Profiler

Browser metrics

What your own browser measured on the profiled page, joined to the server's render on one clock. Vitals against the server, what went wrong in the browser, third-party scripts, the main thread's CPU by island, each island's server, build and browser costs on one row, and its markup before and after it woke.

On this page

A server profile ends at the first byte. What the visitor feels comes after: downloading the files, hydrating islands, the largest paint, the first click. So when you open a page while logged in to the profiler, your browser reports its visit, and the report puts it beside the server’s render.

Nothing to set up: log in at /__profiler (on the dev server there’s no login), then open the page you profiled. The next report of that page, or the one you just made, fills in its browser side. Each report reads its own visit, the first one your browser sent after the report was made, so a second profile after a fix reads the second visit, not a mix.

Visit reporting

The profiler puts a small reporting script into documents served to its own logged-in user, and only to them: the site-wide og_profiler_beacon cookie, signed for your session, is what tells the server you’re that user. Visitors never get the script and pay nothing. The documents that carry it are marked private, no-store, so no shared cache keeps them, and, with clientCpu on (the default), they carry Document-Policy: js-profiling so Chromium lets the page sample its own CPU.

The script is inline in the document’s head and needs nothing else, so every page gets a browser side, including one that never boots ogygia’s runtime (a Kit-hydrated csr = true page, or one with no island). On a page with islands, the plugin’s browser half adds each island’s wake and hydration from the runtime’s own hooks.

The visit holds navigation timing, every file the browser fetched, paints, vitals, layout shifts, long tasks, each island’s wake and hydration (and where it sat on the page), the islands’ markup before and after hydration, and your mark() calls. It’s posted to /__profiler/amondin and also kept in your browser’s store.

A page with hundreds of islands sends a visit larger than 64 KB, more than a browser lets a page send while it closes. So while the page is open the visit goes as an ordinary request, and as it closes a slim copy follows without the parts already sent. The server takes a visit of up to 512 KB, a CPU trace of up to 6 MB, and up to 400 islands.

End-to-end timeline

A page report opens with the whole visit on one time axis. The server’s render (with its phases) is placed so it ends at the document’s first byte. After it come the HTML arriving, every file the browser fetched (one lane per kind: css, script, font, img and fetch, render-blocking files dashed), the main thread’s long tasks, and each island waking, with module loading in light blue and hydration in green. The paints, DOM ready and load are dashed lines, and the first interaction inside each island is a mark.

The bars with a white outline form the critical path, listed under the drawing with the reason each is on it: the biggest part of the server render, the wait for the first byte, the last render-blocking stylesheet before first paint, and what the largest paint sat in (an image, or the island whose markup it is).

Each hole gets its own lane, from the moment its request left, cut into the wait for a render slot on the server, the server render, and the network and swap. This is the same breakdown the dock’s Page tab draws, from the same code. When the profiled render is longer than the visit’s time to first byte (a cache, or a faster instance), the server bar is clipped and labelled so.

Browser vs server

The report shows what your browser measured (TTFB, first paint, LCP, CLS and INP) next to the server’s median render. Two gaps matter, and each gets a finding:

  • ttfb-gap: TTFB is twice the render or more, and 200 ms more. The time is in whatever sits in front of the server (a cold instance, a proxy, the network). For the report’s own visit it’s split further, because the browser timed its redirects and connection and the request log says how long the handler held that request: connecting (a proxy, a CDN, a cold start), or time inside the handler beyond the render (a hook that awaits something).
  • lcp-gap: LCP comes 500 ms or more after TTFB, and at least TTFB again. The time is in what the browser does after the HTML arrives (assets, fonts, hydration), and the finding names the part.

In both cases the answer isn’t in the SSR code. Without a gap, browser-vitals just gives the numbers. The page score takes its loading, stability and responsiveness from the visits.

Browser findings

The visit is read with the same analysis as the dock’s Page tab, so the report and the tab name the same problems on the same islands, with the same codes. Those findings start with “In the browser:”, and Page findings lists every one with its trigger and fix. They cover hydration that failed or changed the markup, early clicks, layout shifts, slow modules and wakes, eager islands below the first screen, long tasks, slow navigations, the slowest interaction, files fetched twice or never cached, and holes that never answered or showed their fallback too long.

A few are the report’s own:

  • Hole waits split a first-screen hole’s fallback time into its server render, found in the server’s request log, and the wait for one of the server’s 4 render slots, so you know whether to fix the hole’s render or its timing.
  • other-screen and other-browser: another visit to this page on a different screen size, or in a different engine, saw problems this one didn’t.
  • browser-limits: the visiting browser can’t report something (Safari and Firefox have no layout-shift, long-task or long-animation-frame entries), so the findings and score parts that need it are missing rather than clean. Visit from Chromium to measure them.

With the browser’s CPU trace, a slow hydrate names the function that took the time (“mostly render_rows (Heavy.svelte:11)”). In the dock’s Profiler tab, hovering one of these findings lights up its islands on the page.

Third parties

Every origin other than the page’s own counts as a third party. The report groups what each served by origin, with a kind read from the host name (tag manager, analytics, ads, session replay, chat, A/B testing, consent, fonts, library CDN). For each origin it shows the JS it served, how many of its scripts the page never names (a tag manager’s tags), whether it held up the first paint, and, with the browser CPU, how long its code ran on the main thread. Three findings come from it:

  • third-party: the total for other origins, the heaviest three, and one fix per kind. For a tag manager, audit its tags, fire them after the page is interactive or on consent, or move to server-side tagging. For a chat widget, a plain button that loads it on its first click. For A/B testing, render the variant on the server.
  • third-party-blocking: another origin’s stylesheet or sync script held up the first paint.
  • third-party-edits: an island didn’t wake from the server’s markup, and a third-party script ran before it woke. A script that edits the DOM under an island is the usual cause.

The dock’s Page tab shows the same table, from the same code.

Browser CPU

When the browser supports JS Self-Profiling (Chromium), the page records its first 8 seconds of main-thread CPU, sampling every 10 ms, and sends it in. The report then gets a browser CPU section built like the server’s: components by self time (each island’s component, from the chunk it hydrated from), hot functions and a flame graph. It answers what the server can’t: which island’s hydration ate the main thread, and whether that was your code, a dependency or Svelte. The JSON lists each island’s hydrate window under browser.cpu.by_island.

Production client chunks are minified, so a frame reads Y in chunks/DvQX.js until a map says otherwise. The build keeps the client maps for the profiler (Source maps), so each frame gets its real name and file: create_effect in Svelte’s runtime, ProductCard in your component. Scripts from another origin keep their minified names and are filed under the package their CDN path names. Turn this off with clientCpu: false.

Islands table

One row per island fingerprint (identical copies share a row, marked ×N), joining three sources:

  • The server. SSR ms is the component’s render time per page render. props is what the island’s props cost and which lane they took: JSON parses on the fast lane, and devalue names the one value that forced the slower lane, such as a Date or a Map. seed refs are props that point into page.data instead of shipping the data twice.
  • The build. JS is the unique weight of the island’s module and its preloads, in a built app. interactivity is what the build found in its components: event handlers, $state, $effect, bind:, use:, remote functions, awaits and shared objects. An island with none of these reads inert: it loads JS for markup that never changes.
  • The browser. hydrate ms is what your browser reported: each island’s wake-to-hydrated time and the module-loading part of it.

A row with advice carries a mark. Opening it shows the modules the browser downloads before that island can run (its own code, marked this island, and the shared files it imports, each with what the build packed into it), the seed keys it references, the devalue culprit, and one line of advice. Svelte’s and ogygia’s runtimes, Kit and devalue load once per page and never count as an island’s own code. The JSON gives each island’s js_only_bytes, the bytes no other island on the page needs: what dropping or deferring it would really save.

This table feeds the island findings (wake-inert, wake-crowd, islands-js-heavy, island-heavy-module, island-barrel, never-hydrated, hydration-mismatch, client-hydrate and island-browser-read), and several of them link back to its rows. Findings gives each one’s trigger and threshold.

Island cost heatmap

Every island on one grid, with a column per cost: server render time, markup bytes, props bytes, unique JS, hydration time, when it finished waking during the visit, the first interaction inside it, and the layout shift its nodes caused. Each cell is shaded against the largest value in its column, and rows are sorted by how many columns an island leads. An island dark across its whole row should be static or wake later; one dark only in JS needs a smaller closure; one whose first interaction came seconds after it woke could wake on interaction. Click a column to sort by it.

DOM time travel

Each island’s markup at three moments (as the server sent it, after it hydrated, and when the page went away), with the diff between them, and the visit’s layout shifts drawn on a page-shaped map with the island that moved. When an island’s hydrated markup differs from the server’s, you see exactly which nodes changed: a design system inserting marks, a script rewriting text, or hydration rendering again. The snapshots are large, so they live only in the browser that made the visit and never reach the server. Open the page once while logged in, and the report reads them from that browser.