Few things in engineering beat tracking down a bizarre performance bug. It's one thing when an app slows down because of an obvious million-iteration loop. It's quite another when the profiler shows 0% CPU usage, yet your UI takes a painful 89 seconds to open.
Cian frontend engineer Anatoly Bartsev ran into that exact mystery while maintaining an internal Chrome extension used daily by over 200 employees. We regularly track browser engine and extension quirks like this in roundups such as Browser Engines and Web Standards: Chrome 155 Updates and Safari on Foldables.
Symptoms and Ruled-Out Suspects
The extension follows modern Chrome Extensions Manifest V3 architecture: a background Service Worker, a React 18 popup, and Ant Design components.
One day, users started reporting that clicking the extension icon froze the UI. The popup finally appeared after 89,035 milliseconds—nearly a minute and a half.
The usual suspects fell apart quickly:
- Heavy bundle? The JS bundle was 1.96 MB. DevTools showed SSD read and script compilation took just 18 ms.
- Slow component rendering? React didn't even get to mount—
DOMContentLoadedtook over a minute to fire. - Service Worker memory leak? The worker sat idle, using a modest 25 MB of RAM.
The Root Cause: A Hidden IPC Storm in chrome.storage
The answer surfaced in low-level Chrome traces (chrome://tracing).
In Manifest V3, chrome.storage.local isn't synchronous like localStorage. It's an asynchronous inter-process communication (IPC) channel built on JSON serialization between the extension process, the browser process, and the background worker.
Inside the extension lived an innocent-looking settings listener:
// Old code with a critical architectural flaw
chrome.storage.onChanged.addListener((changes, areaName) => {
if (areaName !== 'local') return;
if (changes.enabled) {
// BUG: unconditional re-write of the same value!
chrome.storage.local.set({ enabled: changes.enabled.newValue });
}
});
The trap lies in Chromium's API behavior: chrome.storage.local.set() ALWAYS triggers onChanged, even if you write the exact same value (like writing enabled: false again).
That created an infinite loop: a write fired the event, the handler wrote again, and the cycle repeated. Over a workday, more than 250,000 unprocessed messages piled up in the browser's internal IPC queue. When a user clicked the popup, Chrome dutifully worked through that quarter-million empty IPC packets before initializing the window.
A One-Line Fix for a 300x Speedup
The fix required adding a simple state-transition guard:
// background.js / service-worker.js
chrome.storage.onChanged.addListener((changes, areaName) => {
if (areaName !== 'local') return;
if (changes.enabled) {
const { oldValue, newValue } = changes.enabled;
// CRITICAL GUARD: drop identical writes!
if (oldValue === newValue) {
return;
}
console.log("Статус изменен с " + oldValue + " на " + newValue);
updateExtensionBadge(newValue);
}
});
They also added startup timing telemetry in the popup script:
// popup.js
const startTime = performance.now();
document.addEventListener('DOMContentLoaded', () => {
const duration = performance.now() - startTime;
console.log("Холодный старт попапа: " + duration.toFixed(1) + " мс");
chrome.runtime.sendMessage({ type: 'POPUP_METRIC', duration });
});
Never assume the browser checks data equality for you. The chrome.storage API does not perform deep equality checks—every .set() call emits an IPC event. Always compare oldValue !== newValue yourself.
Once the patch shipped, popup open times dropped from 89 seconds back to 289 milliseconds—a textbook example of how knowing platform internals solves tough production mysteries.

![Node.JS [ru]](/api/digests/it_development/daily/20261017/assets/sources/we-use-js.jpg?v=c0e73553e6eb6a7d832be97bcd3f1ecdae4ce271021d2683f468d654debdc973)

