Plugin update check running on each pageload is slow
|Reported by:||DD32||Owned by:|
The plugin update checker was changed to run on every page load, Unfortunately this has had the effect of get_plugins() being called for *every* pageload.
get_plugins appears to be rather slow, Eating up a massive 420ms (of a 450ms page load).
due to the way which get_plugins() is implemented, get_plugin_data is called on every .php file, In some cases, plugin files can be rather large, and when using conditional loading for large plugins, The time to read & parse each file can be expensive, Taking on average 10~50ms on my computer. (ENV: Win32)
It appears that plugin_has_required_fields() which is called often takes on average of 2ms, being called anywhere between 5 to 20 times per file.
Increasing the file read block size to 4096 has sped it up enough for me (Plugin check is now only 190ms in total) for now ( plugin_get_contents() -> fread()
200ms still seems like a rather large ammount of processing time which is being used mearly for the update checker.
Another option would be to move the update checks to be run via CRON unless loading the plugins page directly. This would mean a delay is present when plugins are changed and the plugins page is not visited, but it results in a snappier page load for those with lots of plugins.
(Note: No '2.7' in trac version list)
Change History (43)
- Keywords needs-patch added; has-patch needs-testing needs-unit-tests removed