Performance: Caching strategies
HIGH IMPACT
Caching strategies improve page load speed by reducing server processing and network requests.
<?php
// Use page caching plugin or object cache
// Cached HTML served directly without PHP processing
?><?php // No caching, every page loads fresh get_header(); // heavy database queries here get_footer(); ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No caching, full PHP load | High (dynamic DOM generation) | Multiple reflows due to slow load | High paint cost due to delayed content | [X] Bad |
| Page caching with static HTML | Low (static DOM) | Single reflow after fast load | Low paint cost, content appears quickly | [OK] Good |
| No cache headers on assets | N/A | N/A | High paint cost due to delayed asset load | [X] Bad |
| Cache headers with deferred scripts | N/A | N/A | Low paint cost, faster asset load | [OK] Good |