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 |