Forums / General / template includes and performance

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.