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
-
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. -
Unused Preload Auditor
The headline use case. Inject real
<link rel="preload">resources, consume some and leave others idle, then read back each preload'susedfield — a timestamp when consumed, ornullfor not-consumed-yet. Treatnullas waste only when the page lifetime actually ends;pagehidecan also signal entry into the back/forward cache. -
Speculation Rules Lab
Build a live
<script type="speculationrules">block — pick prefetch vs prerender, aneagernesslevel, and ruletags— inject it, and see how those choices surface in thenavigationsarray with matchingtype,eagernessandtags. -
Pagehide Beacon
The collection pattern the explainer demonstrates: a
pagehidehandler that callsgetSpeculations()and beacons the unused-speculation report withfetch(…, {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 ↗