[wp-trac] [WordPress Trac] #19879: Better caching for get_dirsize

WordPress Trac wp-trac at lists.automattic.com
Tue Jan 24 23:36:06 UTC 2012


#19879: Better caching for get_dirsize
-------------------------+------------------------------
 Reporter:  batmoo       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Multisite    |     Version:  3.3.1
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------
Changes (by kurtpayne):

 * cc: kpayne@… (added)
 * type:  defect (bug) => enhancement


Comment:

 My first thought would be to change `recurse_dirsize()` like so:

 {{{
 } elseif (is_dir($path)) {
         $handlesize = recurse_dirsize( $path );
         if ($handlesize > 0)
                 $size += $handlesize;
 }
 }}}

 to:

 {{{
 } elseif (is_dir($path)) {
         $handlesize = get_dirsize( $path );
         if ($handlesize > 0)
                 $size += $handlesize;
 }
 }}}

 This change would check the cache as it's doing the recursive iteration.
 This is very optimistic, though.  Cache misses would result in a database
 SELECT and UPDATE/INSERT.  For most sites, this change would probably slow
 things down.  Further, this could result in a lot of extra rows in the db
 that wouldn't serve a useful purpose.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19879#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list