From: <php...@li...> - 2002-11-18 19:54:37
|
Greetings, While working on calendar, I needed to create a year view. This particular view is extremely process heavy as it has to create each month using templates. I was hitting one template for each day, week, and month. 7 * 5 * 12 = 420 average file hits for the year view. Phew. Well what I decided to do was store this data in a session array keyed into the year. So whenever that year is hit, it delivers the data without having to hit all those files again. Then I thought of another way to speed up time. The processTemplate function allows you to send a string instead of a filename. So if I stored that template file information, I could just send it instead. After this, I thought why not combine the two? So I copied the processTemplate function into layout. This processTemplate looks in a session named Template. It is indexed by the module name and filename. If the session component exists, it used it INSTEAD of loading the file. If it does not exist, it goes on before loading the file and processing it. It then copies the template file into the session. My file hits should go from around 420 to 3. Now I could have just pulled those files separately but, with the session, it carries over from function to function. The month creation script would lose that template file each one of the eleven other times it was hit for the year view. IMHO I think this could be a substantional speed increase were it implemented in the core. However, there might be issues I am unaware of. So I would like discussion on whether this should be implemented into the processTemplate function. Please vote and post! Thanks, Matt Matthew McNaney Internet Systems Architect Electronic Student Services Email: ma...@tu... URL: http://phpwebsite.appstate.edu Phone: 828-262-6493 ICQ: 141057403 |
From: <php...@li...> - 2002-11-18 23:00:18
|
+ 1 Woot, I likes a lot. I think I will implement that in my modules to. Steven > Greetings, > > While working on calendar, I needed to create a year view. This > particular view is extremely process heavy as it has to create each > month using templates. I was hitting one template for each day, week, > and month. 7 * 5 * 12 = 420 average file hits for the year view. > > Phew. > > Well what I decided to do was store this data in a session array keyed > into the year. So whenever that year is hit, it delivers the data > without having to hit all those files again. > > Then I thought of another way to speed up time. The processTemplate > function allows you to send a string instead of a filename. So if I > stored that template file information, I could just send it instead. > > After this, I thought why not combine the two? So I copied the > processTemplate function into layout. > > This processTemplate looks in a session named Template. It is indexed by > the module name and filename. If the session component exists, it used > it INSTEAD of loading the file. If it does not exist, it goes on before > loading the file and processing it. It then copies the template file > into the session. > > My file hits should go from around 420 to 3. > > Now I could have just pulled those files separately but, with the > session, it carries over from function to function. The month creation > script would lose that template file each one of the eleven other times > it was hit for the year view. > > IMHO I think this could be a substantional speed increase were it > implemented in the core. However, there might be issues I am unaware of. > > So I would like discussion on whether this should be implemented into > the processTemplate function. > > Please vote and post! > > Thanks, > Matt > > > Matthew McNaney > Internet Systems Architect > Electronic Student Services > Email: ma...@tu... > URL: http://phpwebsite.appstate.edu > Phone: 828-262-6493 > ICQ: 141057403 > > > > > ------------------------------------------------------- > This sf.net email is sponsored by: To learn the basics of securing your > web site with SSL, click here to get a FREE TRIAL of a Thawte Server > Certificate: http://www.gothawte.com/rd524.html > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers -- Steven Levin Electronic Student Services Appalachian State University Phone: 828.262.2431 PhpWebsite Development Team URL: http://phpwebsite.appstate.edu Email: st...@NO... |
From: <php...@li...> - 2002-11-19 00:21:39
|
> + 1 Woot, I likes a lot. > > I think I will implement that in my modules to. > > Steven Well we can either transfer it to Layout or add the code to the core class. Either way. Matthew McNaney Internet Systems Architect Electronic Student Services Email: ma...@tu... URL: http://phpwebsite.appstate.edu Phone: 828-262-6493 ICQ: 141057403 |
From: <php...@li...> - 2002-11-19 13:03:39
|
I have committed the new processTemplate function. The old one is named backupTemplate. There is one change. The isString parameter is removed as it is not really needed if the session is caching the data. In its place is a variable named defaultDir. It is set to TRUE, which is normal behavior. If set to FALSE, the function will use the directory and file pointed to by the $template parameter no questions asked. It will not try to compare it to the current theme. Please update, test and let me know what you think. A few changes had to be made to layout to accommodate it so grab those files as well. Matthew McNaney Internet Systems Architect Electronic Student Services Email: ma...@tu... URL: http://phpwebsite.appstate.edu Phone: 828-262-6493 ICQ: 141057403 |
From: Eloi G. <el...@re...> - 2003-03-24 05:04:58
|
I just ran across a bug in a function I submitted, moveElement in core/Array.php. Certain types of arrays won't process properly. It stems from not telling array_reverse to preserve the keys. Just change line 102 from $array = array_reverse($array); to $array = array_reverse($array, true); and change line 114 from $new_array = array_reverse($new_array); to $new_array = array_reverse($new_array, true); Sorry I didn't catch that before. -Eloi- |
From: Matthew M. <ma...@tu...> - 2003-03-24 16:00:33
|
Fixed in CVS. > I just ran across a bug in a function I submitted, moveElement in > core/Array.php. Certain types of arrays won't process properly. It stems > from not telling array_reverse to preserve the keys. > > Just change line 102 from > $array = array_reverse($array); > to > $array = array_reverse($array, true); > > > and change line 114 from > $new_array = array_reverse($new_array); > to > $new_array = array_reverse($new_array, true); > > Sorry I didn't catch that before. > -Eloi- > > > > > ------------------------------------------------------- > This SF.net email is sponsored by:Crypto Challenge is now open! > Get cracking and register here for some mind boggling fun and > the chance of winning an Apple iPod: > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en > _______________________________________________ > Phpwebsite-developers mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpwebsite-developers > |