← Back to release summary

js-profiling-mode=eager|lazy Document-Policy for JS Self-Profiling API

Category
Performance
Type
New or changed feature
Status
Proposed (Chrome Proposed)
Intent stage
None

WPT details: https://wpt.fyi/results/js-self-profiling/js-profiling-mode

Summary

Introduces a new Document-Policy value "js-profiling-mode=eager|lazy". Setting "js-profiling-mode=lazy" authorizes JS Self-Profiling capability without incurring immediate initialization overhead during page load. Related WICG PR : https://github.com/WICG/js-self-profiling/pull/87 Related discussion for more context: https://github.com/WICG/js-self-profiling/issues/86

Motivation

There are several pain points with the current “eager” approach: 1 - Performance trade-offs between loading and profiling There is no way to defer profiling overhead to a non-critical period (e.g., after page load). There is no way to incur overhead only if the Profiling API is actually used. Many users are unwilling to trade page load performance for profiling capabilities. 2 - Sampling strategy coupling between backend (server) and frontend (client) To avoid overhead on unsampled sessions, sampling must be aligned between server and client, which introduces operational complexity. In many setups, sampling occurs on the client side; keeping server and client in sync requires additional tooling. Even if a session is not sampled, the presence of the header means the page still pays the warm-up cost. (See https://github.com/WICG/js-self-profiling/issues/86 for full context)

Standards & signals

Ecosystem

Docs: https://github.com/WICG/js-self-profiling/issues/86 https://wicg.github.io/js-self-profiling/#js-profiling-mode

Explainers: https://github.com/WICG/js-self-profiling/issues/86

View on chromestatus.com