demo · v149
Cache Key Probe
The inline-script cache is keyed by SHA-256 of the script source plus the network isolation key. Edit one byte of the script body and the key changes — the cache misses, the script must be parsed and compiled from scratch again. Watch the verdict flip.
Each "Load" runs the script inside a freshly-created blob iframe and times performance.now() from open to onload. The "verdict" column compares the SHA-256 of the script body across runs. Same key = should be cached (HIT). New key = recompile (MISS).
code
// Conceptual: each inline <script> gets cached by
// SHA-256( script body ) + network isolation key
const enc = new TextEncoder();
const hashBuf = await crypto.subtle.digest('SHA-256', enc.encode(source));
const key = [...new Uint8Array(hashBuf)]
.map(b => b.toString(16).padStart(2, '0')).join('');
The browser doesn't expose the cache lookup directly — but the timings make it observable. The first time a hash shows up, parse/compile runs in full. Subsequent runs with the same hash should be substantially faster on Chrome 149+ because the bytecode is restored from cache.
see also
- Inline script cache — feature index
- Cold vs Warm — repeated load timings
- ChromeStatus entry
- V8: Code caching for devs
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗