[wp-trac] [WordPress Trac] #7372: Plugin update check running on each pageload is slow

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 22 13:26:25 GMT 2008


#7372: Plugin update check running on each pageload is slow
----------------------------+-----------------------------------------------
 Reporter:  DD32            |       Owner:  anonymous               
     Type:  defect          |      Status:  new                     
 Priority:  normal          |   Milestone:  2.7                     
Component:  Administration  |     Version:  2.6                     
 Severity:  normal          |    Keywords:  needs-patch dev-feedback
----------------------------+-----------------------------------------------
 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)

-- 
Ticket URL: <http://trac.wordpress.org/ticket/7372>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list