How to Fix “Reduce JavaScript execution time” (bootup-time) in WordPress
Lighthouse triggers “Reduce JavaScript execution time” when parsing, compiling, and executing scripts consumes more than 2.0 seconds of mobile CPU time—freezing taps and tanking Total Blocking Time (30% of your PageSpeed score).

Open WP Admin -> KadiCache -> CSS & JavaScript and select Delay Until Interaction so GTM, ad pixels, chat SDKs, and non-essential bundles consume 0 ms of initial bootup CPU.
Enable Smart Cart Fragments under CSS & JavaScript -> Commerce & Smart Cart and Replace YouTube iframes with preview image under Lazyload to stop AJAX hydration and player bootup spikes.
Turn OFF Rocket Loader in KadiCache -> Cloudflare -> Speed & Network and click Apply Recommended Preset in Bloat Removal to disable frontend Heartbeat and legacy WP scripts.
- Lighthouse attributes V8 CPU time to every individual script URL consuming
>= 50 ms(Total = Script Evaluation + Script Parse + Compile), warning above2.0 secondsand failing red above3.5 seconds. - Key Distinction — Bytes vs CPU: Reduce unused JavaScript measures wasted file size (
KiB), whereas Reduce JavaScript execution time measures actual CPU burn (ms)! A tiny14 KBplugin script runningquerySelectorAll("*")inside aMutationObservercan burn900 msof CPU with0 KiBunused bytes! - Because
bootup-timedirectly drives Long Tasks (> 50 ms), fixing this single audit improves Total Blocking Time (30%PSI weight) and real-user Interaction to Next Paint (INP) more than almost any other change. - 100% Free Core Stack: Delay JS Until Interaction + Smart Cart Fragments + YouTube Preview Facade + Bloat & Heartbeat Control.
Table of Contents (5 sections)
- How Lighthouse Attributes bootup-time Per Script URL
- The 5 Heaviest JavaScript CPU Hogs on WordPress & WooCommerce
- Finding Runaway Custom Scripts in Chrome DevTools (Bottom-Up View)
- How KadiCache Clears Reduce JavaScript execution time in Free Core
- Fine-Grain Opt-Outs Without Re-Introducing bootup-time Failures
How Lighthouse Attributes bootup-time Per Script URL#
During a PageSpeed Insights run, Chromium’s V8 engine samples the call stack every microsecond on the main thread. Lighthouse maps every EvaluateScript, v8.compile, FunctionCall, FireAnimationFrame, and TimerInstall event back to the exact script URL at the bottom of the stack, displaying three columns:
Total CPU Time: Combined milliseconds that script kept the main thread busy.Script Evaluation: Executing functions, DOM queries, framework hydration, event listeners, and timers.Script Parse: Decompressing, tokenizing, and compiling JavaScript source text into V8 bytecode.
Whenever you see Unattributable or your own page URL (/) near the top of the bootup-time table, that CPU time came from inline <script> blocks printed directly inside HTML (such as GTM custom HTML snippets, Elementor elementorFrontendConfig initializers, or inline WooCommerce JSON handlers) or browser extensions if you accidentally ran DevTools outside Incognito!
The 5 Heaviest JavaScript CPU Hogs on WordPress & WooCommerce#
Script Row in bootup-time | Typical Mobile CPU Time | Why It Burns So Much CPU |
|---|---|---|
googletagmanager.com/gtm.js + Ad Pixels (fbevents.js, clarity.js) | 950 ms – 2,600 ms | Evaluates tag triggers, scrapes DOM buttons/forms for auto-event tracking, and fires cascading marketing pixels |
youtube.com/s/player/.../base.js | 650 ms – 1,400 ms per video | Compiles a massive video player app and initializes MediaSource buffers before anyone clicks Play |
Live Chat & Support Widgets (Intercom, Zendesk, Tidio, Crisp) | 450 ms – 1,100 ms | Boots a full client-side React/Preact single-page app + WebSocket connection inside an iframe |
wc-cart-fragments.min.js & Heavy Filter / Wishlist Plugins | 220 ms – 680 ms | Fires /?wc-ajax=get_refreshed_fragments on boot and re-parses mini-cart DOM fragments across every product card |
Page-Builder Motion Effects & MutationObserver Plugins | 280 ms – 850 ms | Attaches non-passive scroll listeners or runs MutationObserver({ subtree: true }) across 3,000 DOM nodes |
Finding Runaway Custom Scripts in Chrome DevTools (Bottom-Up View)#
If a custom theme script or inline snippet is burning 400+ ms even on lean pages, profile it in Chrome DevTools in 20 seconds:
1. Open your URL in a clean Incognito window (0 browser extensions!).
2. Open DevTools (F12) -> Performance tab -> click Capture Settings (gear icon).
3. Set CPU to "4x slowdown" and click "Record and reload page".
4. Click the "Bottom-Up" tab at the bottom -> set Group By to "URL".
5. Expand the heaviest script URL to see the exact function name and line number!When fixing custom theme JavaScript manually, replace continuous window.addEventListener("scroll", ...) geometry polling with native IntersectionObserver, always pass { passive: true } on touch/wheel listeners, and scope MutationObserver strictly to a small container instead of document.body.
How KadiCache Clears Reduce JavaScript execution time in Free Core#
- Zero Bootup CPU for Non-Essential Bundles (
DelayJsOptimizer.php): Selecting Delay Until Interaction inWP Admin -> KadiCache -> CSS & JavaScript(Delay JS Guide) keeps GTM, ad pixels, chat widgets, and non-critical plugin scripts at0 msbootup CPU during initial page load. Better yet,DelayScriptClassifier.phpreplays interactive UI handlers before background analytics tags when the visitor taps or scrolls—so first-tapINPstays razor-sharp! - Automatic Safety Guards (
ScriptOptimizer.php&ConsentScripts.php): Payment gateways (Stripe,PayPal,Apple Pay), security challenges (Turnstile,reCAPTCHA), WooCommerce/cart/&/checkout/flows, and GDPR consent managers (Complianz,CookieYes,Cookiebot) are respected automatically. - Eliminate WooCommerce & Media CPU Spikes (
Smart Cart+YouTube Facade): Enable Smart WooCommerce Cart Fragments (Commerce & Smart Cart) so empty-cart guests skipwc-ajax=get_refreshed_fragmentshydration (WooCommerce Guide), and enable Replace YouTube iframes with preview image (Lazyload) to erase1,000+ msofbase.jsCPU. - Disable Frontend Heartbeat & Legacy WP Bloat (
Bloat Removal): Click Apply Recommended Preset inWP Admin -> KadiCache -> Bloat Removal(Bloat & Heartbeat Guide) to stopheartbeat.min.js,wp-emoji-release.min.js, andjquery-migrate.min.jsfrom running on public pages.
Fine-Grain Opt-Outs Without Re-Introducing bootup-time Failures#
Sometimes a single lightweight above-the-fold widget (like an interactive SaaS ROI slider or immediate gtag pageview ping) must execute on initial load while 1.2 MB of chat, heatmap, and social pixels stay delayed. Use KadiCache’s targeted opt-out patterns instead of turning off Delay JS globally:
<!-- Executes immediately via safe defer (~8 ms CPU) while GTM/Meta/Chat stay delayed! -->
<script src="/wp-content/themes/agency/assets/js/pricing-slider.min.js"
defer
data-kadicache-no-delay></script>| Real-World Scenario | Exact Exclusion Substring (Delay JS Exclusions) | Initial bootup-time Impact |
|---|---|---|
| Immediate GA4 Pageview Count (0s Bounces) | googletagmanager.com/gtag/js (keep gtm.js / Meta / Clarity delayed) | ~45 – 80 ms (well inside < 2.0 s pass budget!) |
| Custom Above-the-Fold Pricing Calculator | /assets/js/pricing-slider.min.js or data-kadicache-no-delay | ~10 – 25 ms |
Checkout & Cart Payment SDKs (Stripe, PayPal) | None needed! Automatically protected by DelayScriptClassifier.php & route rules | 0 ms on catalog/blog pages; 100% intact on /checkout/ |
| CookieYes / Complianz / Cookiebot Banner | None needed! Automatically recognized by ConsentScripts.php | Compliant immediate banner with minimal CPU |
“Reduce JavaScript execution time” — Frequently Asked Questions
Why did my local Chrome DevTools Lighthouse test show chrome-extension:// URLs inside Reduce JavaScript execution time?
Why did combining 18 JavaScript files into one giant bundle make bootup-time WORSE?
Does KadiCache Delay JS break WooCommerce variable product swatch dropdowns or Add to Cart?
What if an essential above-the-fold script (like a live stock ticker or interactive mortgage calculator) must run immediately on load?
Can server-side tracking (Cloudflare Zaraz or Server-Side GTM) also help reduce JavaScript execution time?
Creator of KadiCache’s Early PHP Drop-In, 7-Driver Object Cache Engine, Cloud Remove Unused CSS, and Zero-CLS Lazy Render pipeline.
Understand the > 50 ms Long Task math connecting JS execution time to PSI scores.
Compare unexecuted JS payload bytes vs main-thread CPU execution time.
Optimize all 6 main-thread buckets including Style, Layout, and Paint.
Inspect KadiCache’s Free Core JavaScript execution and jQuery safety engine.