Php code against template language

Author Message

Jean-Yves Zinsou

Thursday 26 February 2009 1:29:26 am

Hi to all,
Can someone explain why heavy computing is done faster when making a custom template operator that does the computing in php than when using template language?
The template language is compiled and stored as php as well too so why is it slower ?
I have seen many topics saying that heavy computing tasks should be done with custom operators....

Thanks to any one that takes a little time to answer this question.

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

Damien Pobel

Thursday 26 February 2009 1:55:00 am

Hi,

The template compiler doesn't understand what you try to do, it simply applies general rules so the generated code is far from being optimized and the generated code is ugly (see files in var/something/cache/template/compiled).
If you write your own code you will probably try to make it as simple as possible which is often faster.

Cheers

Damien
Planet eZ Publish.fr : http://www.planet-ezpublish.fr
Certification : http://auth.ez.no/certification/verify/372448
Publications about eZ Publish : http://pwet.fr/tags/keywords/weblog/ez_publish

Jean-Yves Zinsou

Thursday 26 February 2009 2:21:01 am

Thanks , i will take a look at the compiled template code, just to know...

Greedings from an another eZpublish developper in Montpellier ;-)

Do Androids Dream of Electric Sheep?
I dream of eZpubliSheep....
------------------------------------------------------------------------
http://www.alma.fr

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 18 2025 16:17:09
Script start
Timing: Jan 18 2025 16:17:09
Module start 'layout'
Timing: Jan 18 2025 16:17:09
Module start 'content'
Timing: Jan 18 2025 16:17:10
Module end 'content'
Timing: Jan 18 2025 16:17:10
Script end

Main resources:

Total runtime0.6269 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0044 589.3516152.6250
Module start 'layout' 0.00440.0018 741.976639.4609
Module start 'content' 0.00610.6195 781.4375540.7188
Module end 'content' 0.62560.0013 1,322.156312.1563
Script end 0.6269  1,334.3125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.4854160.0002
Check MTime0.00130.2130160.0001
Mysql Total
Database connection0.00050.081610.0005
Mysqli_queries0.581992.8158570.0102
Looping result0.00050.0812550.0000
Template Total0.602196.020.3010
Template load0.00230.370020.0012
Template processing0.599795.659720.2999
Template load and register function0.00010.015610.0001
states
state_id_array0.00090.137010.0009
state_identifier_array0.00090.151220.0005
Override
Cache load0.00180.2814190.0001
Sytem overhead
Fetch class attribute can translate value0.00050.082620.0003
Fetch class attribute name0.00090.148950.0002
XML
Image XML parsing0.00100.156920.0005
class_abstraction
Instantiating content class attribute0.00000.001760.0000
General
dbfile0.00080.1339220.0000
String conversion0.00000.001040.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 14
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs