v150 · Performance

Speculative load measurement

A proposed performance.getSpeculations() method exposes the speculative loads your page made — preconnects, preloads, and speculation-rules navigations — and, for preloads specifically, whether each had been consumed when read (a used timestamp or null). A final lifecycle-end read can help RUM libraries identify waste and evaluate whether more eager speculation pays off.

concepts

  1. Speculation Inspector

    The core surface: press a button that calls the real performance.getSpeculations() and pretty-prints the whole returned object — preconnects, preloads, navigations, navigationDestinationURL — field by field, with a live capability probe that can return false.

  2. Unused Preload Auditor

    The headline use case. Inject real <link rel="preload"> resources, consume some and leave others idle, then read back each preload's used field — a timestamp when consumed, or null for not-consumed-yet. Treat null as waste only when the page lifetime actually ends; pagehide can also signal entry into the back/forward cache.

  3. Speculation Rules Lab

    Build a live <script type="speculationrules"> block — pick prefetch vs prerender, an eagerness level, and rule tags — inject it, and see how those choices surface in the navigations array with matching type, eagerness and tags.

  4. Pagehide Beacon

    The collection pattern the explainer demonstrates: a pagehide handler that calls getSpeculations() and beacons the unused-speculation report with fetch(…, {keepalive:true}). Fire the exact handler on demand and inspect the JSON payload that would be sent to analytics.

why it's proposed

Speculation Rules, preload and Early Hints let sites start work before the user commits to a navigation — but pushing eagerness past “conservative” is a gamble. Aggressive prefetching and prerendering burn user bandwidth and server capacity, and until now developers had no way to see whether that spend paid off. Server logs can't reliably correlate a speculative request with a later navigation, and cached responses hide the signal entirely. The WICG explainer behind this feature proposes performance.getSpeculations() to close the loop: it reports the current document's speculative loads — including cross-origin ones — without exposing cross-origin data, with the metadata (as, eagerness, tags, earlyhint) needed to act on it. The navigation destination URL is same-origin-only, and its exact exposure shape is still provisional (the explainer keeps an open TODO on it). Note this is a proposal with an experimental Chromium implementation — not a shipped standard.

references

implementation reference

Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗