PB-2601: Slow function
Paul Bunyan code PB-2601 (Warning): Slow function. What it means and what to do.
On this page
What it means
One function attached to a hook took longer than the slow-function threshold. The time includes whatever that function called.
What to do
The message gives the function, plugin, file and line. "Inside" shows how the time splits between queries, outside calls, email and plain PHP.
Common causes
- A function doing database work in a loop, or one slow query (see its "Inside" line).
- A call to another server inside the function (PB-2401).
- Loading and parsing large files or settings on every request.
- Plugins that do setup work on
initorwp_loadedfor every page, even pages that don't use them.
How to find and fix it
- The message gives the function, plugin, file and line. "Inside" splits its time into queries, outside calls, email and plain PHP.
- Mostly queries: look at the Database screen for that function. Mostly outside calls: cache the answer or move it to the background. Mostly plain PHP: it is processor work (PB-2104).
- If the function runs on every page but is only needed on a few, ask the plugin's author whether it can load only where needed.
- Compare before and after an update with Compare, using the marker Paul Bunyan saves on each plugin update.
Details
| Code | Severity | Group |
|---|---|---|
| PB-2601 | Warning | Code |
