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

Running different versions of Smarty within the same script
Goto page Previous  1, 2, 3  Next
 
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
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Tue Aug 26, 2003 5:38 pm    Post subject: Reply with quote

Maybe the 2.6.0 code / template is sitting on a fragile part of your disk? Laughing it makes no sense. For the sake of argument, how does a STOCK 2.6.0RC1 compare to 2.5.0 (without your code changes).

greetings.
Back to top
View user's profile Send private message
Sepodati
Smarty Rookie


Joined: 25 Aug 2003
Posts: 17
Location: Georgia, USA

PostPosted: Tue Aug 26, 2003 5:38 pm    Post subject: Reply with quote

I'll try it with display(), also (w/output buffering).

I'll switch the other templates to also display within output buffering, too, to make it all equal.

---John Holmes...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Sepodati
Smarty Rookie


Joined: 25 Aug 2003
Posts: 17
Location: Georgia, USA

PostPosted: Wed Aug 27, 2003 2:39 am    Post subject: Reply with quote

I tried it with display() and using an unmodified version of 2.6 by itself, but it is still coming out slow.

You can get all of the files here:

http://sepodati.realxl.net/tpl_bench/tpl_bench.zip (380K)

to try it yourself and maybe explain what I'm doing wrong... Smile

---John Holmes...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Aug 27, 2003 3:56 am    Post subject: Reply with quote

Sepodati, I installed your benchmarks and I for one am seeing results consistent with what you report. Using an accelerator helps a lot (in some tests, 2.5.0 performs better than eval (w/caching, w/opts) and occasionally even better than include! (w/caching, wo/opts)) but these synthetics, where kind to 2.5.0, are apparently unkind to 2.6.0RC1.

aside: for these samples, the compiled templates that each 2.5.0 and 2.6.0RC1 generate are identical.

If I have time I will run a profile but so far I'm liking the numbers that 2.6.0RC1 is giving me with against my actual production code. An interesting situation, though. I'll have to diff your changes and dig a bit deeper.

I should have been clearer about fetch() and display()--sorry. I noticed you altered the code in index2.php and put ob_start() and ob_end_clean() around display(). It should actually be around a fetch() since display() does that implicitly but then also goes to the bother of echoing the output, which isn't required.

Nice archive, by-the-way.


Last edited by boots on Wed Aug 27, 2003 5:06 am; edited 2 times in total
Back to top
View user's profile Send private message
Sepodati
Smarty Rookie


Joined: 25 Aug 2003
Posts: 17
Location: Georgia, USA

PostPosted: Wed Aug 27, 2003 4:27 am    Post subject: Reply with quote

What if you try the current CVS with the benchmark? Does that fare any better?

I have a job site that I'm working on right now that uses 2.5. I'll have to install 2.6 there and see if I notice a difference in speed.

---John Holmes...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Aug 27, 2003 4:52 am    Post subject: Reply with quote

boots wrote:
so far I'm liking the numbers that 2.6.0RC1 is giving me with against my actual production code.
I meant smarty-cvs there Smile

I just tried your synthetics against the cvs and there isn't much difference from RC1. Confused
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Aug 27, 2003 9:12 am    Post subject: Reply with quote

i tracked the reason for the high-numbers for 2.6.0-RC1 down to an issue with Smarty's path-caching. it does not get triggered if you only have one call to display()/fetch() in your code, but it gets triggered by

[php:1:97b48dc87c]$smarty = new smarty()
$smarty->fetch("foo.tpl");
$smarty = new smarty()
$smarty->fetch("foo.tpl");[/php:1:97b48dc87c]

or by

[php:1:97b48dc87c]$smarty = new smarty();
$smarty->fetch("foo.tpl");
$smarty->fetch("bar.tpl");
$smarty->fetch("foo.tpl");[/php:1:97b48dc87c]

i think 2.6.0-RC2 will contain a fix for this Smile
Back to top
View user's profile Send private message Send e-mail Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Wed Aug 27, 2003 9:16 am    Post subject: Reply with quote

@messju: wow, you tracked that quickly Smile
Back to top
View user's profile Send private message
Sepodati
Smarty Rookie


Joined: 25 Aug 2003
Posts: 17
Location: Georgia, USA

PostPosted: Wed Aug 27, 2003 11:07 am    Post subject: Reply with quote

boots wrote:
@messju: wow, you tracked that quickly Smile
Yeah, no kidding. Good job.

---John Holmes...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Aug 27, 2003 12:53 pm    Post subject: Reply with quote

'nah, it wasn't that hard:

- load the page to ensure everything is compiled
- remove all files in smarty2.6/core
- reload the page and look where smarty pukes Smile

if everything was okay no files from core/ are needed to display simple templates like the ones in this benchmark.
but here core.assemble_auto_filename.php was requested because the auto-filenames didn't come from the path-cache as they should have.

but thanks anyway.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sepodati
Smarty Rookie


Joined: 25 Aug 2003
Posts: 17
Location: Georgia, USA

PostPosted: Wed Aug 27, 2003 10:34 pm    Post subject: Reply with quote

I've updated the benchmark site with the (even more) modified version of 2.6RC1 and it comes out just slightly slower than 2.5. There could be other issues like this that are causing the slight slowdown, but at least it's reasonable now (and still pretty much beating the other engines!)

---John Holmes...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Aug 28, 2003 7:17 am    Post subject: Reply with quote

Hi again.

Before I realized you updated your site, I went and did a little cheat in the index.php file, taking into account what messju said about object creation:

in Smarty2*() functions:[php:1:4bfe23bda9]global $tpl;
if !isset($tpl) {$tpl = new Smarty2;}[/php:1:4bfe23bda9]
With this change, I'm finding virtually no difference between 2.5 and 2.6--well, 2.6 is a tiny bit faster, but slightly less is being done for it. Actually, it makes me wonder if it is prudent to be including the object creation in the timing loops.
Back to top
View user's profile Send private message
Sepodati
Smarty Rookie


Joined: 25 Aug 2003
Posts: 17
Location: Georgia, USA

PostPosted: Thu Aug 28, 2003 10:58 am    Post subject: Reply with quote

boots wrote:
Actually, it makes me wonder if it is prudent to be including the object creation in the timing loops.
Actually, I think the parsing of the include file should be included within the timing loop, because that plays into the overall "overhead" of using these engines. If I did it that way, though, I'd only be able to go through the loop once otherwise I'd get errors about the functions being redeclared...

---John Holmes...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Aug 28, 2003 4:44 pm    Post subject: Reply with quote

Sepodati wrote:
boots wrote:
Actually, it makes me wonder if it is prudent to be including the object creation in the timing loops.
Actually, I think the parsing of the include file should be included within the timing loop, because that plays into the overall "overhead" of using these engines.


Actually, I disagree, especially in Smarty's case. In general, it is suggested never to instance Smarty more than once and certainly never in a loop. If you are after page performance, you might consider timing page requests (perhaps via curl). Just a thought.
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Thu Aug 28, 2003 5:08 pm    Post subject: Reply with quote

i think Sepodati is already überfair to smarty (and maybe the other template-engines) to not include the classes' load- and parsing-time into account. of course instanciating the template-engine-object should be taken into account when measuring the page-load time. and especially when measuring the overhead of a template-engine against a plain php approach (what Sepodati had in mind in the first place, AFAIR)

smarty-2.6.0-rc1 is slower than 2.5.0 here because of initializing the path-cache. the benchmark shows this is big overhead (2.6.0 has to handle 2 files where 2.5.0 has to handle only one). the path-cache only speeds up things when using plugins or {include} but is significant overhead in simple situations (only variable-replacements).

a the moment this is my personal result out of Sepodati's benchmark that makes me think about the path-caching-approach. unfortunately i have no estimation how complex "the average smarty-template" is to tell if the path caching is a boon or bane overall.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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