From: Jay R. / S. <cry...@co...> - 2004-05-27 22:34:27
|
Harry, I've looked at this a couple times, and it seems to work fairly well. The enhancements on my machine weren't very much, but my development machine isn't necessarily the most suited to that - it's a 2.4G P4. I saw a .3 - .5 second change. I want to investigate any possible unseen side-effects of implementing this, but in general, I like it. At 11:18 AM 5/21/2004, Harry Otten wrote: >Hi, > >My gallery runs on a slow server (300mhz) and for some albums it took up to >15 seconds to load. >I made a cache for the getNextPhoto methode and now it takes about 8 or 9 >seconds to load. :D > >It's a discussion if we should cache all the recursion. > >Without: >Array >( > [0] => 2 > [2] => 7 > [7] => 9 > [9] => 10 > [10] => 11 > [11] => 12 > [12] => 13 > [13] => 14 > [14] => 16 > [16] => 17 > [17] => 18 > [18] => 19 > [19] => 20 > [20] => 21 > [21] => 23 >) > >With: >Array >( > [1] => 2 > [0] => 2 > [6] => 7 > [5] => 7 > [4] => 7 > [3] => 7 > [2] => 7 > [8] => 9 > [7] => 9 > [9] => 10 > [10] => 11 > [11] => 12 > [12] => 13 > [13] => 14 > [15] => 16 > [14] => 16 > [16] => 17 > [17] => 18 > [18] => 19 > [19] => 20 > [20] => 21 > [22] => 23 > [21] => 23 >) > >For the speed it doesn't matter much. But there is currently not benefit for >recurssion caching. > >Cheers, >Harry > >No patch to day, just a simple copy & past: > >Call the current methode something like function getNextPhoto2($idx,$album) >And add the following code: > >function getNextPhoto($idx,$album=NULL) { > global $_nextPhotoCache,$gallery; > > if (!$album) { > $album = $gallery->album; > } > > /* > In g1.4.3-p1 nobody ever calls this methode with different albums >names.. so i don't need to check this > if ($_nextPhotoCache["albumnaam"]!=$album->fields["name"]) { > $_nextPhotoCache=array(); > $_nextPhotoCache["albumnaam"] = $album->fields["name"]; > } > /* > > if (!empty($_nextPhotoCache[$idx])) > return $_nextPhotoCache[$idx]; > > $_nextPhotoCache[$idx] = getNextPhoto2($idx,$album); > return $_nextPhotoCache[$idx]; >} > > > > >------------------------------------------------------- >This SF.Net email is sponsored by: Oracle 10g >Get certified on the hottest thing ever to hit the market... Oracle 10g. >Take an Oracle 10g class now, and we'll give you the exam FREE. >http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click >__[ g a l l e r y - d e v e l ]_________________________ > >[ list info/archive --> http://gallery.sf.net/lists.php ] >[ gallery info/FAQ/download --> http://gallery.sf.net ] --- Jay Rossiter http://www.cothlamadh.net/ 503.381.6143 cry...@co... |