Upgrade to Pro — share decks privately, control downloads, hide ads and more …

๐Ÿ‡ซ๐Ÿ‡ท dotJS 2026

๐Ÿ‡ซ๐Ÿ‡ท dotJSย 2026

Web Performance APIs That You (Probably) Never Knew Existed

Responsiveness to user interaction is crucial for modern web apps, and weโ€™ve all heard about many fantastic tools for measuring and optimizing performance.

However, we no longer have to rely entirely on pre-built dashboards to understand performance. Browsers already expose a rich set of native performance APIs that let us go deeper.

In this talk, weโ€™ll explore lesser-known platform primitives for measuring responsiveness and diagnosing bottlenecks. From observers and timing APIs to scheduling primitives and resource hints, through navigation improvements like View Transitions.

Be ready to turn your browser into a performance toolkit and build performance metrics that reflect what your users really care about.

Avatar for Matheus Albuquerque

Matheus Albuquerque PRO

September 18, 2026

More Decks by Matheus Albuquerque

Other Decks in Programming

Transcript

  1. WEB PERFORMANCE APIS THAT YOU ( PROBABLY ) NEVER KNEW

    EXISTED MATHEUS ALBUQUERQUE โ€ข @ythecombinator
  2. THIS TALK PRESENTSโ€ฆ โ† PREAMBLE โ† MEASURING WITH THE PLATFORM

    โ† IMPROVING WITH THE PLATFORM โ† CLOSING THOUGHTS
  3. WEB PERFORMANCE APIS THAT YOU (PROBABLY) NEVER KNEW EXISTED REACT:

    INTERNALS AND ADVANCED PERFORMANCE PATTERNS/ LAYOUT INSTABILITY
  4. LAYOUT INSTABILITY: OVERVIEW โ† MANY WEBSITES HAVE DOM ELEMENTS SHIFTING

    AROUND DUE TO CONTENT LOADING ASYNCHRONOUSLY. โ† THIS API ALLOWS YOU TO: โ† MEASURE REAL CLS VALUES IN PRODUCTION. โ† IDENTIFY THE EXACT DOM ELEMENTS RESPONSIBLE FOR LAYOUT INSTABILITY. โ† IGNORE EXPECTED SHIFTS CAUSED BY USER.
  5. LAYOUT INSTABILITY: OVERVIEW const observer new PerformanceObserver((list) for (const entry

    of list.getEntries()) { if (entry.hadRecentInput) continue; const source entry.sources?.[0]?.node; console.log("Shift:", entry.value, source); } }); observer.observe({ type: "layout-shift", buffered: true, > = = = }); {
  6. LAYOUT INSTABILITY: OVERVIEW const observer new PerformanceObserver((list) for (const entry

    of list.getEntries()) { if (entry.hadRecentInput) continue; const source entry.sources?.[0]?.node; console.log("Shift:", entry.value, source); } }); observer.observe({ type: "layout-shift", buffered: true, > = = = }); {
  7. LAYOUT INSTABILITY: OVERVIEW const observer new PerformanceObserver((list) for (const entry

    of list.getEntries()) { if (entry.hadRecentInput) continue; const source entry.sources?.[0]?.node; console.log("Shift:", entry.value, source); } }); observer.observe({ type: "layout-shift", buffered: true, > = = = }); {
  8. LAYOUT INSTABILITY: IDEAS โ† DETECT INSTABILITY INTRODUCED BY THIRD-PARTY EMBEDS

    OR PERSONALIZATION. โ† DETECT IMAGES OR IFRAMES LOADING WITHOUT A RESERVED SPACE. โ† DETECT LAYOUT SHIFTS CAUSED BY WEB-FONT SWAPS.
  9. LONG ANIMATION FRAMES: OVERVIEW โ† DETECT UPDATES THAT TAKE MORE

    THAN 50 MS. โ† CAPTURE WORK ACROSS JAVASCRIPT + RENDERING, NOT JUST SCRIPT EXECUTION. โ† ATTRIBUTE SLOW FRAMES TO THE SCRIPTS AND PHASES CONSUMING TIME. โ† USEFUL FOR UNDERSTANDING JANK, RESPONSIVENESS ISSUES, AND INP REGRESSIONS.
  10. LONG ANIMATION FRAMES: OVERVIEW const observer new PerformanceObserver((list) { for

    (const entry of list.getEntries()) { console.log("Duration:", entry.duration); console.log("Blocking:", entry.blockingDuration); console.log("Scripts:", entry.scripts); } }); observer.observe({ type: "long-anim ation-frame", buffered: true, > = = });
  11. LONG ANIMATION FRAMES: OVERVIEW const observer new PerformanceObserver((list) { for

    (const entry of list.getEntries()) { console.log("Duration:", entry.duration); console.log("Blocking:", entry.blockingDuration); console.log("Scripts:", entry.scripts); } }); observer.observe({ type: "long-anim ation-frame", buffered: true, > = = });
  12. LONG ANIMATION FRAMES: OVERVIEW const observer new PerformanceObserver((list) { for

    (const entry of list.getEntries()) { console.log("Duration:", entry.duration); console.log("Blocking:", entry.blockingDuration); console.log("Scripts:", entry.scripts); } }); observer.observe({ type: "long-anim ation-frame", buffered: true, > = = });
  13. LONG ANIMATION FRAMES: IDEAS DETECT: โ† INP REGRESSIONS. โ† RENDERING

    PIPELINE BOTTLENECKS. โ† ANIMATION FRAME DROPS. โ† SLOW CSS/LAYOUT RECALCULATIONS. โ† SCRIPTS FORCING EXPENSIVE STYLE/LAYOUT.
  14. SELF PROFILING: OVERVIEW โ† RUNS A SAMPLING PROFILER ON REAL

    USERS' DEVICES. โ† PERIODICALLY SNAPSHOTS THE CURRENT JAVASCRIPT CALL STACK. โ† FINDS STATISTICALLY FREQUENT HOT PATHS WITHOUT INSTRUMENTING EVERY FUNCTION. โ† LOWER OVERHEAD THAN TRACING EVERY FUNCTION ENTRY/EXIT.
  15. SELF PROFILING: OVERVIEW const profiler new Profiler({ sampleInterval: 10, maxBufferSize:

    10000 }); await doWork(); const profile await profiler.stop(); = = console.log(profile.samples);
  16. SELF PROFILING: IDEAS โ† PROFILE THIRD-PARTY SCRIPT EXECUTION TIME. โ†

    DETECT HOT LOOPS IN DATA PROCESSING PIPELINES. โ† PROFILE HYDRATION BOTTLENECKS. โ† DETECT REGRESSIONS AFTER FEATURE ROLLOUT.
  17. MEMORY USAGE: OVERVIEW โ† ESTIMATE HOW MUCH MEMORY YOUR PAGE

    IS USING IN THE BROWSER. โ† BREAK USAGE DOWN ACROSS JAVASCRIPT, DOM, AND OTHER BROWSER-MANAGED RESOURCES. โ† TRACK MEMORY GROWTH OVER TIME TO SPOT POTENTIAL LEAKS. โ† USEFUL FOR LONG-LIVED APPS WHERE PERFORMANCE DEGRADES GRADUALLY.
  18. MEMORY USAGE: LEAKS #1 const obj { a: new Array(1000),

    b: new Array(2000) }; setInterval(() { console.log(obj.a); > = = }, 1000);
  19. MEMORY USAGE: LEAKS โ† FORGETTING TO UNREGISTER AN EVENT LISTENER.

    โ† ACCIDENTALLY CAPTURING OBJECTS FROM AN IFRAME. โ† NOT CLOSING A WORKER. โ† ACCUMULATING OBJECTS IN ARRAYS. โ† AND MUCH MORE!
  20. COMPUTE PRESSURE: OVERVIEW โ† OBSERVE WHEN THE USERโ€™S DEVICE IS

    UNDER SIGNIFICANT CPU PRESSURE. โ† EXPOSES COARSE PRESSURE STATES INSTEAD OF RAW HARDWARE UTILIZATION. โ† LETS APPS ADAPT WORKLOAD AND VISUAL QUALITY DYNAMICALLY. โ† USEFUL FOR EXPENSIVE RENDERING, ANIMATIONS, WEBGL, AND BACKGROUND PROCESSING.
  21. COMPUTE PRESSURE: OVERVIEW const observer const record new PressureObserver((records) records.at(-1);

    if (record?.state === "critical") { reduceRenderingQuality(); } }); observer.observe("cpu", { sampleInterval: 2000, > = = = }); {
  22. COMPUTE PRESSURE: OVERVIEW const observer const record new PressureObserver((records) records.at(-1);

    if (record?.state === "critical") { reduceRenderingQuality(); } }); observer.observe("cpu", { sampleInterval: 2000, > = = = }); {
  23. COMPUTE PRESSURE: OVERVIEW const observer const record new PressureObserver((records) records.at(-1);

    if (record?.state === "critical") { reduceRenderingQuality(); } }); observer.observe("cpu", { sampleInterval: 2000, > = = = }); {
  24. COMPUTE PRESSURE: IDEAS โ† LOWER CANVAS RESOLUTION DYNAMICALLY. โ† PAUSE

    BACKGROUND DATA PROCESSING PIPELINES. โ† SWITCH FROM REAL-TIME UPDATES TO BATCHED ONES. โ† DROP FRAME RATE IN WEBGL SCENES. โ† REDUCE ANIMATION QUALITY WHEN CPU PRESSURE RISES.
  25. PRECONNECT: OVERVIEW โ† IT ALLOWS THE BROWSER TO SET UP

    EARLY CONNECTIONS BEFORE THE REQUEST IS ACTUALLY SENT TO THE SERVER. THIS INCLUDES: โ† TLS NEGOTIATIONS โ† TCP HANDSHAKES โ† REDUCES CONNECTION SETUP LATENCY.
  26. PRECONNECT: IDEAS 100MS 200MS 300MS 400MS 500MS 600MS 700MS HTML

    CSS FONT 1 FONT 2 FONTS START LOADING FONTS RENDERED
  27. PRECONNECT: IDEAS 100MS 200MS 300MS 400MS 500MS 600MS HTML CSS

    FONT 1 FONT 1 FONT 2 FONT 2 FONTS START LOADING FONTS RENDERED 700MS
  28. SPECULATION RULES: OVERVIEW โ† A MODERN AND MORE EXPRESSIVE REPLACEMENT

    FOR OLDER PRERENDER TECHNIQUES. โ† DESIGNED TO IMPROVE PERFORMANCE FOR FUTURE DOCUMENT NAVIGATIONS. โ† PREFETCH/PRERENDER DOCUMENTS AHEAD OF CLICKS. โ† TARGETS FUTURE DOCUMENT NAVIGATIONS, ESPECIALLY MPAS.
  29. SPECULATION RULES: OVERVIEW <script type="speculationrules"> { "prefetch": [ { "urls":

    ["/checkout"] } ], "prerender": [ { "where": { "href_matches": "/product/ " } } ] } * </script>
  30. SPECULATION RULES: IDEAS โ† PREFETCH /DASHBOARD AFTER LOGIN SUCCESS. โ†

    PREFETCH /CHECKOUT AFTER CART INTERACTION. โ† PREFETCH TOP RESULT LINKS IN THE VIEWPORT. โ† PRERENDER LIKELY NEXT SETTINGS TAB.
  31. PRIORITY HINTS: OVERVIEW โ† TELL THE BROWSER WHAT MATTERS FIRST.

    โ† INFLUENCE DEFAULT FETCH HEURISTICS WHEN NEEDED. โ† OPTIMIZE LCP RESOURCES EXPLICITLY.
  32. Increase the priority of the LCP image <img src="image.jpg" fetchpriority="high"

    /> Lower the priority of above-the-fold images <ul class="carousel"> <img src="img/carousel-1.jpg" fetchpriority="high" /> <img src="img/carousel-2.jpg" fetchpriority="low" /> <img src="img/carousel-3.jpg" fetchpriority="low" /> </ul> Reprioritize scripts <script src="async_but_important.js" async fetchpriority="high"></script> > - - > - - > - - - - - - - - ! ! <script src="blocking_but_unimportant.js" fetchpriority="low"></script> ! < < < PRIORITY HINTS: OVERVIEW
  33. Increase the priority of the LCP image <img src="image.jpg" fetchpriority="high"

    /> Lower the priority of above-the-fold images <ul class="carousel"> <img src="img/carousel-1.jpg" fetchpriority="high" /> <img src="img/carousel-2.jpg" fetchpriority="low" /> <img src="img/carousel-3.jpg" fetchpriority="low" /> </ul> Reprioritize scripts <script src="async_but_important.js" async fetchpriority="high"></script> > - - > - - > - - - - - - - - ! ! <script src="blocking_but_unimportant.js" fetchpriority="low"></script> ! < < < PRIORITY HINTS: OVERVIEW
  34. Important validation data const user await fetch("/user"); Less important content

    data = = / const relatedPosts / / / PRIORITY HINTS: OVERVIEW await fetch("/posts/suggested", { priority: "low" });
  35. Important validation data const user await fetch("/user"); Less important content

    data = = / const relatedPosts / / / PRIORITY HINTS: OVERVIEW await fetch("/posts/suggested", { priority: "low" });
  36. PRIORITY HINTS: IDEAS โ† BOOST HERO IMAGE PRIORITY. โ† DEPRIORITIZE

    RECOMMENDATION PANELS. โ† DEPRIORITIZE BELOW-FOLD IMAGES.
  37. NATIVE LAZY LOADING: OVERVIEW WITH ZERO JAVASCRIPT, YOU CANโ€ฆ โ†

    DEFER IMAGE AND IFRAME DOWNLOADS AUTOMATICALLY. โ† LET THE BROWSER DECIDE OPTIMAL FETCH TIMING. โ† REMOVE OFF-SCREEN CONTENT FROM THE CRITICAL RENDERING PATH.
  38. NATIVE LAZY LOADING: OVERVIEW <img src="/gallery-1.jpg" loading="lazy" width="800" height="600" />

    <iframe src="https://maps.example.com" loading="lazy" width="600" height="400"> </iframe>
  39. NATIVE LAZY LOADING: OVERVIEW <img src="/gallery-1.jpg" loading="lazy" width="800" height="600" />

    <iframe src="https://maps.example.com" loading="lazy" width="600" height="400"> </iframe>
  40. NATIVE LAZY LOADING: IDEAS โ† PRODUCT GALLERY IMAGES. โ† EMBEDDED

    PLAYERS, MAPS AND CHAT WIDGETS. โ† DASHBOARDS BELOW THE FOLD.
  41. SCHEDULE TASKS: OVERVIEW โ† SCHEDULE TASKS WITH EXPLICIT PRIORITY. โ†

    COORDINATE WITH THE BROWSER RENDERING PIPELINE. โ† REPLACE setTimeout( , 0) HACKS. โ† SUPPORTS CANCELLATION VIA SIGNALS. . . . โ† WORKS IN WORKERS TOO.
  42. YIELDING: OVERVIEW โ† SPLIT LONG TASKS SAFELY. โ† RETURN CONTROL

    TO THE BROWSER MID-EXECUTION. โ† AVOID BLOCKING INPUT AND RENDERING. โ† REPLACE MANUAL CHUNKING LOOPS.
  43. SMOOTH NAVIGATION: OVERVIEW SAME-DOCUMENT โ€ข SPA document.startViewTransition(async () CROSS-DOCUMENT โ€ข

    MPA { @view-transition { await updateTheCurrentDocument(); navigation: auto; > } = });
  44. #win ๐Ÿ† No need to force an MPA to become

    an SPA just to get continuity.
  45. WEB PERFORMANCE APIS THAT YOU (PROBABLY) NEVER KNEW EXISTED #1

    Core Web Vitals are a better starting point than a nish line. fi โ€” IN THE BLINK OF AN EYE โ€ข TIM KADLEC , 2024
  46. WEB PERFORMANCE APIS THAT YOU (PROBABLY) NEVER KNEW EXISTED Existing

    RUM tools are #2 greatโ€”until scale, cost, or product-speci c questions force you to measure things fi yourself.
  47. VENDORS CANโ€™T MEASURE YOUR โ€œREADYโ€ TIME UNTIL THEโ€ฆ โ† SCROLL

    EFFECTS WORK. โ† APP RESPONDS TO CLICKS. โ† MOST MEANINGFUL VIDEOS/ANIMATIONS RUN. โ† PRIMARY FEATURE SHOWS UP/IS INTERACTIVE. โ† COOKIE BANNER SHOWS UP.
  48. WEB PERFORMANCE APIS THAT YOU (PROBABLY) NEVER KNEW EXISTED AI

    agents can write JS. But engineers who #3 understand scheduling, rendering, and other fundamentals can decide what should be optimized.
  49. WEB PERFORMANCE APIS THAT YOU (PROBABLY) NEVER KNEW EXISTED There's

    probably a business case for #4 making your app faster. But web performance is about more than โ€œjustโ€ business.