Forums / Developer / Templates and site efficiency

Templates and site efficiency

Author Message

Tore Skobba

Monday 20 October 2003 8:10:37 am

Hi all

I am currently making an FAQ page, it is build up like this:

Folder, containing variable number of categories, each category have several faq_qeustions under it (an content class). I am using node_view_gui for all of this, so that each question which is displayed require an read to the template file. However, might it be better for me to drop the template files for the questions, and instead directly in the fetch loop in the category write all questions? This in order to avoid all the fileaccess? Guess this question basically boils down to how efficient the cache is. And wherever modularity should be sacrified for speed.

cheers
Tore

Eirik Alfstad Johansen

Tuesday 21 October 2003 1:06:30 am

Hi Tore,

Though someone else might know the actual answer to this question, if you don't get it, I would try the FAQ page with and without the node_view_gui and then comparing the run times (turn on debugging to view them).

Sincerely,

Eirik Johansen
Netmaking AS

http://www.netmaking.no/

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

Paul Forsyth

Tuesday 21 October 2003 1:47:25 am

Cache is the key here. We use the same structure on this page:

http://www.pobox.co.uk/po_box/frequently_asked_questions

That is, use a faq template with node_view_gui calls to include the faq items themselves. Once the cache is built the result is a single page to display.

Performance will likely depend on the number of items in your faq - number of templates to pull in - but i don't see it being a problem.

Paul

Tore Skobba

Tuesday 21 October 2003 2:39:28 am

Hi all.. Made one modular solution with one template for each faq questions. Then made another solution where the output of each faq question where done in each faq category.

Did a few runs and the results are below here:

With faq_qeustion template:
Clear cache loading of page took: 1.3249 sec
then reload four times gave these times:
0.6021 sec
0.5205 sec
0.4966 sec
0.5110 sec

Without faq_question template:
Clear cache, loading of page took 1.1789 sec
then reloead four times gave these times:
0.4056 sec
0.4084 sec
0.4357 sec
0.3989 sec

As you can see this is not very much statistical material, but the results are consistent in that the version with the fewest templates are the fastest. Note that I only had 2 faq questions, as such the difference in templates between the two runs where 2)

Cheers.

Paul Forsyth

Tuesday 21 October 2003 3:45:52 am

Just had a play with our site with cache and i can see that the cache is built based on each class. So there is one cache file for the main faq class and another for the faq items it pulls in. This may explain the discrepency you see - files still need to pulled in. However, since they are already processed the overhead isn't much and should scale nicely.

From a maintence point of view i would prefer the seperate class approach. It saves me more time.

Paul