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

eZ debug

Timing: Jan 31 2025 00:45:27
Script start
Timing: Jan 31 2025 00:45:27
Module start 'content'
Timing: Jan 31 2025 00:45:27
Module end 'content'
Timing: Jan 31 2025 00:45:27
Script end

Main resources:

Total runtime0.3210 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 588.9063370.2969
Module start 'content' 0.00820.0132 959.20311,005.5156
Module end 'content' 0.02140.2995 1,964.71883,894.1875
Script end 0.3209  5,858.9063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00441.3787200.0002
Check MTime0.00140.4266200.0001
Mysql Total
Database connection0.00100.303810.0010
Mysqli_queries0.223469.61181410.0016
Looping result0.00130.41531390.0000
Template Total0.299093.110.2990
Template load0.00100.306910.0010
Template processing0.298092.831810.2980
Override
Cache load0.00060.201610.0006
Sytem overhead
Fetch class attribute can translate value0.00180.559910.0018
XML
Image XML parsing0.00040.129610.0004
General
dbfile0.01003.1220200.0005
String conversion0.00000.001330.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs