[wp-trac] [WordPress Trac] #34359: Cache output of `wp_upload_dir()` to improve performance

WordPress Trac noreply at wordpress.org
Mon Oct 19 21:50:13 UTC 2015


#34359: Cache output of `wp_upload_dir()` to improve performance
------------------------------------+-------------------------
 Reporter:  DH-Shredder             |      Owner:
     Type:  defect (bug)            |     Status:  new
 Priority:  normal                  |  Milestone:  4.4
Component:  Media                   |    Version:
 Severity:  normal                  |   Keywords:  needs-patch
  Focuses:  multisite, performance  |
------------------------------------+-------------------------
 While testing the Responsive Images support for core, we found that in
 some cases `wp_upload_dir()`, through its `get_options()` calls, made up
 approximately 1/3 of the runtime, sometimes up more than 300ms on pages
 that had 50+ images.

 @joemcgill notes that we can reduce this almost entirely by caching the
 output -- at the very least per page-view, and optimally, in the object
 cache.

 Initially chatted with @jeremyfelt [https://wordpress.slack.com/archives
 /feature-respimg/p1445280317000100 about this in RespImg], and agrees with
 the need and seems to think the approach is sane.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34359>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list