What throttling does#
Chrome DevTools' Performance panel offers CPU throttling, which slows the page's work relative to the machine it runs on. The same control is available to scripts through the DevTools Protocol's Emulation.setCPUThrottlingRate. Chrome DevTools: Performance features reference · Protocol: Emulation.setCPUThrottlingRate
We timed a loop of 30 million iterations in a Chromium page. It took 46 ms unthrottled and 191 ms at a rate of 4: about four times slower, as the rate says.
The rate is relative. A 4× slowdown on a fast desktop is not the same machine as 4× on an older laptop. Treat the setting as "slow enough to reproduce", not as a model of the reporter's device.
Throttle from a script#
const cdp = await page.context().newCDPSession(page);
await cdp.send('Emulation.setCPUThrottlingRate', { rate: 6 });
This works in Chromium only. Set it before the steps that matter, and reset it with rate: 1.
Find the rate that reproduces it#
Start at a high rate, such as 6 or 20, to confirm the bug depends on speed at all. Then lower it until the bug stops, and report the boundary: "reproduces at 4×, not at 2× on an M2 laptop". With the machine named, the maintainer can choose a comparable rate on theirs.
If no rate reproduces it, speed of the page is not the cause. Look at the network instead: only on slow connections, or at the order of responses: hold one response.
Measure the reporter's device, if you can#
A rough measure from the reporter makes the comparison concrete. Ask them to run the same loop in the Console:
(() => { const s = performance.now(); let x = 0; for (let i = 0; i < 3e7; i++) x += i % 7; return Math.round(performance.now() - s); })()
Compare it with the same loop on the maintainer's machine. A reporter's 180 ms against a maintainer's 45 ms suggests starting near 4×. It is a crude benchmark of one kind of work, so use it only to pick a starting rate. Also note navigator.hardwareConcurrency, the number of logical processors the browser reports.
What throttling does not reproduce#
- Memory pressure. A phone that discards background tabs or a page that runs out of memory. Throttling does not limit memory.
- Thermal slowdown that varies over time on a real device.
- GPU-bound work, such as heavy animation or canvas drawing, which depends on the graphics hardware.
- Other engines. It is a Chromium feature.
Worked example: a click that hit the wrong row#
This example is fictional. A support agent using an older laptop reports that clicking Refund in a list of orders sometimes refunds the order below the one they clicked. Nobody else can reproduce it.
At 6× throttling, the developer sees the list re-render after a slow data refresh, inserting a new order at the top 300 ms after the page looks ready. A click during that window lands on the row that moved into place under the pointer. At 1× the refresh finished within one frame and nothing moved. The fix disabled row actions until the refresh completed and kept rows stable by ID, and the throttled script became a test.
Questions#
Does CPU throttling slow down network requests?
No. Requests still complete at network speed, which can change the order of events compared with a genuinely slow device, where response handling is also slow. Combine CPU and network throttling when both matter.
Can I throttle in Firefox?
Firefox's developer tools do not offer the same CPU throttling control. Use a Chromium-based browser for the reproduction, or a slower real device.
Is the Performance panel recording itself slowing the page?
Recording adds overhead. Reproduce with throttling first, then record a profile of the failing run separately.
Return to reproducing what someone else saw for the other layers a replay needs.