Web Performance Calendar

The speed geek's favorite time of year
2026 Edition
ABOUT THE AUTHOR
Photo of Jacob Groß

Jacob Groß (@kurtextrem) loves everything related to tooling, accessibility, Web Vitals, CSS & JavaScript performance. Currently Staff Performance Engineer at Framer.

As a performance engineer, I’ve seen tens of thousands of traces over the years. And yet I’ve been bitten by some, let’s call them quirks, that misguide you into fixing issues that aren’t performance issues. Not just me. Agents also run into this and claim performance improvements when, in reality, it’s just overhead from profiling. Even the Google Chat team has run into this, where they noticed this only because of a production A/B test.
I and potentially you have wasted countless human hours (and tokens) chasing ghosts, so I set out to write this, to stop the waste for good.

🤖 This blog post is written with humans and agents in mind, so in case you have an agent (or if you’re an agent), check out the fitting skill: kurtextrem/devtools-papercuts.

Table of contents

Let’s get started:

setTimeout and similar functions look 6-26× more expensive

setTimeout has always been a special kind of function. In the past, setTimeout(..., 0) did not mean literally 0 ms. Different browsers implemented different kinds of clamping (so “0” turned into “1” and similar). This has improved, but there are tons of other quirks, related to nested calls, throttling when a tab or iframe is in the background and other things (see MDN).
Agents usually know these things, though, so what truly bites here is that, in traces captured from Chrome DevTools, setTimeout and similar calls can look more expensive than they really are.

My colleague Ivan Akulov has asked about it before. The TL;DR is that DevTools collects stack traces and doing so can add up (see also and here), but it’s surprising that a tool that is supposed to show you what’s slow makes these calls slower.

Grouped bar chart showing that the six callback API calls took about 6 to 26 times as long with timeline events, stacks and CPU samples enabled in Chrome 158.

Ways around it:

Invalidation Tracking makes appendChild/removeChild/insertBefore 11-21× more expensive

Some Chrome DevTools features have a “warning”, e.g. “Enable CSS selector stats (slow)”. This makes it very obvious that enabling those useful features can change traces. The selector stats can sometimes be helpful, so at times this is a worthy trade-off.

In the Chrome DevTools settings, you can turn on “Invalidation tracking”. It tracks what DOM change makes style or layout stale, what work has to be redone, affected nodes and reasons and the related JavaScript call site (source). Again, very useful information, but it does not have a “(slow)” warning and I think it should:

Median call times in Chrome 158 with invalidation tracking off and on. body.appendChild went from 0.06 to 1.25 µs (about 21×), insertBefore from 0.13 to 2.72 µs (about 21×), and removeChild from 0.25 to 2.78 µs (about 11×).

Ways around it:

  • Turn off “Invalidation tracking” unless you need it (CDP: omit disabled-by-default-devtools.timeline.invalidationTracking)

Chrome DevTools Protocol (CDP) and its quirks

These quirks will not bite you as a human directly, but they’ll bite you if you rely on agents to measure for you. Most agents invoke the CDP, and if they do some of the following, numbers may look worse than they really are.

Runtime.enable makes AbortErrors 7× more expensive

Quoting my agent, where I found a performance fix “too good to be true”:
Agent response figuring out a claimed performance improvement really was a CDP limitation

Runtime.enable makes V8 collect extra error stack information, which, as we’ve learned in the first point of this blog post, can be pretty expensive. So AbortErrors look more expensive than they really are.

CDP setup Median abort() time at 100 levels of recursion vs. Runtime events off
Runtime events off 1.91 µs Baseline
Runtime.enable 13.55 µs ≈7.1× slower
Runtime enabled, inspector stack limit set to zero 1.80 µs ≈1.06× faster

Ways around it:

  • Tell your agent not to use Runtime.enable
  • Let your agent set Runtime.setMaxCallStackSizeToCapture({size: 0})
  • (Alternatively, use abort("") – but I would not recommend changing the runtime just because of a quirk)

Runtime.enable makes console.log 13× more expensive

When Runtime.enable is used, V8 wraps the arguments to a console call and sends a Runtime.consoleAPICalled event even if nothing consumes it. This can produce overhead inside hot loops, making them appear slower than they are.

CDP setup Median time to log a short message with an object vs. Runtime events off
Runtime events off 1.41 µs Baseline
Runtime.enable 18.55 µs ≈13× slower

Ways around it:

  • Tell your agent not to use Runtime.enable
  • Use User Timing marks instead of console.log

DOM.getDocument may make DOM operations appear slower

When an agent grabs the entire DOM with DOM.getDocument({depth: -1}), it triggers a ‘side effect’: Blink now tracks updates to these DOM nodes, which means that if a child is inserted under one of those parents, Blink builds a protocol object for the new node, which causes overhead.

CDP setup before the same DOM edits Median sibling insertion time vs. DOM.enable alone
DOM.enable alone (close to baseline) 0.16 µs Reference
After DOM.getDocument({depth: -1}) 0.78 µs ≈4.9× slower

Ways around it:

  • Collect the full DOM snapshot after what you want to profile
  • If you need the snapshot to find the element, inspect it in a separate run and use a fresh target for measuring

The first click in a raw CDP trace appears 89× slower than it is

In a trace taken with Chrome DevTools, it starts an async expression after trace start to trigger V8’s profiler initialization. If you take a raw CDP trace, nothing does it for you, which means that if a script clicks right after Tracing.start, that click can end up starting V8’s CPU profiler:

Trace setup on a page with 10,000 compiled functions Median click-to-handler delay vs. warmed-up trace
Raw CDP trace with CPU sampling 26.83 ms ≈89× slower
Same trace settings, with the Performance panel’s warmup 0.30 ms Baseline

Ways around it:

  1. After Tracing.start, send Runtime.evaluate to the page’s CDP session with expression: "(async function(){ await 1; })()" and throwOnSideEffect: true
  2. Wait for the response before starting the timed action

CDP network throttling quirks

CDP throttling can hide the effect of HTTP/2 request priority

When using Network.emulateNetworkConditions, Chrome’s request-level throttler splits the download budget roughly evenly among requests waiting on it. It can do that even when Chrome sends a higher urgency for one of them.

Throttling setup Equal priorities Critical request given higher priority Speedup
Network.emulateNetworkConditions 1,006 ms 1,004 ms ≈1.00×
HTTP/2 server that schedules by urgency 963 ms 251 ms ≈3.84×

How much this helps in production depends on how your server or CDN schedules competing responses, see also Robin Marx’s 2022 PerfCalendar post: HTTP/3 Prioritization Demystified.

Ways around it:

  • Turn off CDP throttling and cap throughput on a TLS/HTTP/2 server that schedules responses using Chrome’s actual Priority headers
  • If you’re testing a priority change after a request has started, use a server that also honors PRIORITY_UPDATE frames

Emulated latency can hide a backend speedup

Chrome’s request-level throttler uses latency as a minimum time from sending a request to receiving response headers. A response that takes longer than the configured latency can arrive at almost the same time with throttling on or off:

Server delay CDP latency off CDP latency set to 100 ms Slowdown
0 ms 1.2 ms 105.2 ms ≈87.7×
55 ms 57.2 ms 105.4 ms ≈1.84×
170 ms 172.2 ms 172.7 ms ≈1.00×

Removing 55 ms of server work saved 56 ms with CDP latency off and just 0.2 ms with it on.

Ways around it:

  • Use a network shaper outside Chrome when the test calls for adding a fixed round-trip delay to the connection

CDP request interception adds a delay to every matching request

CDP’s Fetch.enable pauses matching requests until your client tells Chrome to continue. This adds overhead even if your client makes no changes to the request:

Interception Time for 30 requests Slowdown
Off 14.8 ms Baseline
Continue immediately 21.0 ms ≈1.42×
Wait 5 ms in the handler, then continue 208.0 ms ≈14.05×

Ways around it:

  • If you only need to observe requests, use Network events
  • When you need interception, match only the requests you need to change

Papercuts agents already know

I of course also spent the time to investigate what papercuts models are already aware of, so my skill doesn’t waste tokens. These seem to be the ones (across various labs, so including Anthropic, Google, OpenAI) that are known. These may be still useful to know for you as a human.

  • Enabling the debugger can change which Wasm code runs: When you use the debugger in DevTools, it might swap optimized Wasm for a variant that allows stepping through (source). Chrome DevTools stops its debugger before taking a trace. This is not the case when starting a trace from CDP, which means you can accidentally end up measuring an unoptimized Wasm variant (roughly 2× slower).
  • Collecting coverage can make functions appear slower: DevTools’ Coverage panel makes V8 discard optimized code when it starts collecting precise coverage, which can make loops appear 10× slower than they are
  • Workers aren’t impacted by CPU throttling: DevTools throttling does not throttle workers, only the main thread.
  • Playwright quirks: page.route() disables the HTTP cache, even if your handler just calls route.continue() (this can also make your CI slower!), and launches Chromium with the back/forward cache disabled

The rest of it

There are a few more minor papercuts, including the CPU cost of capturing screenshots, documented in the skill. All numbers in this blog post come from the same M4 Pro Macbook, with Chrome 158 – the repo itself contains the scripts so you can reproduce.

Also, I’m happy for any contributions that extend the list / skill, see you on GitHub! 🙂

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
And here's a tool to convert HTML entities