Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Performance of Assigned Var's

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
iriePub
Smarty Regular


Joined: 16 Jun 2006
Posts: 53

PostPosted: Tue Aug 15, 2006 12:47 pm    Post subject: Performance of Assigned Var's Reply with quote

Hi,
is smarty getting slower when I assign much variables, or doesn't it matter?
I don't know, how smarty really works.

If it works like this (pseudocode):
Code:

foreach($assigned_vars $varname=>$value) {
  $content = str_replace($ldelim . '$' . $varname . $rdelim, $value, $content);
}

it would getting much more slower. but if smarty first matches all Vars by using preg_match_all() it would not getting much slower, because only the really in template used var's would get replaced, and not all /like in the 1. example).

I hope you understand me ...

thanks!!
Back to top
View user's profile Send private message
shannera
Administrator


Joined: 13 Feb 2006
Posts: 802
Location: Edertal, Germany

PostPosted: Tue Aug 15, 2006 1:41 pm    Post subject: Reply with quote

Why not look at the source code for yourself and do a little analysis. e.g. in the compiler class?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Aug 15, 2006 1:41 pm    Post subject: Reply with quote

No it doesn't get slower with more assigned vars. Variables are compiled once from {$foo} to something like <?=$this->_tpl_vars['foo']?>, and then executed as plain php from that point forward.
Back to top
View user's profile Send private message Visit poster's website
iriePub
Smarty Regular


Joined: 16 Jun 2006
Posts: 53

PostPosted: Tue Aug 15, 2006 2:09 pm    Post subject: Reply with quote

mohrt wrote:
No it doesn't get slower with more assigned vars. Variables are compiled once from {$foo} to something like <?=$this->_tpl_vars['foo']?>, and then executed as plain php from that point forward.

great answer, thanks!
Back to top
View user's profile Send private message
iriePub
Smarty Regular


Joined: 16 Jun 2006
Posts: 53

PostPosted: Wed Aug 16, 2006 3:49 pm    Post subject: Reply with quote

which settings can improve the performance of smarty EXCEPT caching?
I disabled force_compile, check_compile, what else can I do? thanks!!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP