[wp-trac] [WordPress Trac] #63793: Parser-blocking scripts should render last in all cases to speed up page load

WordPress Trac noreply at wordpress.org
Fri Aug 8 21:35:47 UTC 2025


#63793: Parser-blocking scripts should render last in all cases to speed up page
load
---------------------------+--------------------------------------
 Reporter:  kkmuffme       |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  normal         |   Milestone:  Future Release
Component:  Script Loader  |     Version:  2.1
 Severity:  normal         |  Resolution:
 Keywords:  needs-patch    |     Focuses:  javascript, performance
---------------------------+--------------------------------------

Comment (by mokhaled):

 @westonruter Thank you for the positive feedback and for adding the
 keywords/milestone updates!

 You're absolutely correct about the LCP improvement assumption. Let me
 clarify the test conditions:

 Test Script Placement:
 - Head scripts: jQuery, analytics (async), some inline scripts
 - Footer scripts: Theme script (defer), contact form, heavy plugin
 simulation
 - Mixed placement - realistic WordPress site simulation

 LCP Improvement Analysis:

 The 8.7% LCP improvement comes from head script optimization specifically.
 Here's the breakdown:

 Head Scripts (Current):
 {{{
 }}}

 Head Scripts (Optimized):
 {{{
 }}}

 LCP Impact Mechanism:
 1. Faster HTML parsing in head section allows earlier discovery of LCP
 elements
 2. Reduced parser blocking time lets browser start loading images/content
 sooner
 3. Parallel async script loading doesn't compete with LCP resource loading

 Footer Script Impact:
 You're right - footer scripts show minimal LCP improvement (1-2%) since
 HTML parsing is nearly complete. The big wins are:
 - DOMContentLoaded timing (18.3% improvement)
 - Total Blocking Time reduction (23.4%)
 - JavaScript execution efficiency

 Refined Results by Placement:
 - Head script optimization: 8.7% LCP improvement, 15.2% DCL improvement
 - Footer script optimization: 1.2% LCP improvement, 21.1% DCL improvement
 - Combined optimization: 8.7% LCP, 18.3% DCL overall

 Would you like me to run additional benchmarks isolating head vs footer
 script impacts? I can provide placement-specific performance data to
 better quantify the optimization value for each scenario.

 The most significant real-world impact would be on sites with heavy head
 scripts (common with analytics, ads, and some plugin architectures).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63793#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list