Code Snippets can time each PHP snippet as it runs, so you can see which snippets are slowing your site down. When performance tracking is on, every execution is measured and the results are kept for each snippet.
Turning it on
Performance tracking is off by default, because measuring adds a small overhead to every snippet run. Turn it on when you’re investigating a slow page: open Snippets → Settings, open the Insights tab, and enable Track Snippet Performance. It’s fine to leave it off in production until you need it.
What is recorded
- Last run — how long the most recent execution took, in milliseconds.
- Maximum — the slowest execution seen since the stats were last reset.
- Moving average — an average across recent runs, so a single slow request doesn’t dominate the picture.
- Samples — how many times the snippet has run since the stats were reset.
When a snippet’s code changes, its timing stats are reset, because the old timings no longer describe the new code. You can also reset the stats for a single snippet, or for the whole library at once.
These numbers appear next to each snippet in the snippets list — see Insights on the Snippets List and Admin Bar.
This feature requires Code Snippets Pro, 4.0 or later.