template includes and performance

Author Message

*- pike

Tuesday 22 January 2008 5:06:41 am

Hi

Can't seem to find any info on this:

"Does including templates (using {include .. } ) decrease performance ?"

I would say, when template-compiling is on, the includes are actually included in the php code, If that is true, there is no difference at all (well, perhaps a msec while compiling). But I can't find the code that would do that ..

does anyone know?
*-pike

---------------
The class eZContentObjectTreeNode does.

*- pike

Tuesday 12 February 2008 11:54:59 am

Found my own answer

>I would say, when template-compiling is on, the includes are actually included
>in the php code, If that is true, there is no difference at all

But it isn't true.

Includes in templates, when compiled, become includes in PHP.

{include uri="SomeIncludedThing.tpl"}


becomes

<?include("SomeCompiledIncludedThing.php")?>

In other words - each EZP template is compiled into 1 PHP file.

And since SomeCompiledIncludedThing.php contains some wrapper php code (to prepare the actual compiled templatecode), including templates generates more php code, when compiled, then writing the template code all in one single template.

*-pike

---------------
The class eZContentObjectTreeNode does.

Abdelkader RHOUATI

Tuesday 12 February 2008 1:28:09 pm

hi,

perhaps there is no difference (or a small one). if we compare in way that ez compile the code {include ...}.

but for me, include templates in others, permit organize the code, then if i want to change a part of my site, i know exactely where i will do it. and this is a big differents.

some things are create for this reasons , just for improve the quality of devellopement...

tks

Abdelkader.

Abdelkader RHOUATI

Blog (french) : http://arhouati.com
----
Extension arh_jdebug : EzDebug using jquery

*- pike

Tuesday 12 February 2008 1:59:06 pm

absolutely. i love includes. i include everything.

but there is a downside, it decreases performance (a bit).

actually, i think it is a missed chance for ezpublish - one of the benefits for using a template language and compiling it into php is you could use includes while developing, and still have very efficient php after compiling (because the includes would be, well, included). but this is **not** the case as it is now (as far as i can see).

*-pike

---------------
The class eZContentObjectTreeNode does.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 03:38:58
Script start
Timing: Jan 19 2025 03:38:58
Module start 'layout'
Timing: Jan 19 2025 03:38:58
Module start 'content'
Timing: Jan 19 2025 03:38:59
Module end 'content'
Timing: Jan 19 2025 03:38:59
Script end

Main resources:

Total runtime0.9026 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.1563152.6250
Module start 'layout' 0.00590.0024 741.781339.4453
Module start 'content' 0.00830.8928 781.2266548.8203
Module end 'content' 0.90110.0015 1,330.046912.1563
Script end 0.9026  1,342.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.3584160.0002
Check MTime0.00130.1455160.0001
Mysql Total
Database connection0.00130.143710.0013
Mysqli_queries0.845093.6150600.0141
Looping result0.00060.0636580.0000
Template Total0.871896.620.4359
Template load0.00200.226820.0010
Template processing0.869896.362320.4349
Template load and register function0.00020.022610.0002
states
state_id_array0.00090.101910.0009
state_identifier_array0.00120.137820.0006
Override
Cache load0.00170.1909350.0000
Sytem overhead
Fetch class attribute can translate value0.00160.177520.0008
Fetch class attribute name0.00160.182750.0003
XML
Image XML parsing0.00240.271020.0012
class_abstraction
Instantiating content class attribute0.00000.001150.0000
General
dbfile0.00350.3847160.0002
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs