Performance: Security plugins
MEDIUM IMPACT
Security plugins affect page load speed and interaction responsiveness by adding extra scripts and server checks during page rendering.
<?php // Example of optimized security plugin using scheduled scans add_action('init', function() { // Only run lightweight checks on page load check_basic_security(); }); // Schedule heavy scans via WP-Cron add_action('wp_scheduled_scan', function() { scan_all_files(); check_for_malware(); });
<?php // Example of a security plugin that runs heavy scans on every page load add_action('init', function() { // Heavy file scan or database check scan_all_files(); check_for_malware(); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Heavy scans on every page load | No extra DOM nodes | Triggers multiple reflows due to delayed HTML | High paint cost due to delayed content | [X] Bad |
| Lightweight checks with scheduled scans | No extra DOM nodes | Minimal reflows, fast HTML delivery | Low paint cost, faster content display | [OK] Good |