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

Questionable Insert performance?

 
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
_Will
Smarty Rookie


Joined: 17 Apr 2003
Posts: 5

PostPosted: Thu Apr 17, 2003 11:58 pm    Post subject: Questionable Insert performance? Reply with quote

I read somewhere that using Inserts on templates to get around the caching feature can have a negative impact on performance.

This concerns me as I am building a large membership (free) based site, where the users can register for extra features. Their login status is checked by an insert I have on every page which calls two functions (session/cookie checker + userdetails retriever) and then outputs a link to their profile in the same place on each template.

Is there an alternative method to using an Insert, or was the person that spoke of poor performance un-informed?

Thanks Smile
Back to top
View user's profile Send private message
messju
Administrator


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

PostPosted: Sat Apr 19, 2003 1:55 pm    Post subject: Reply with quote

no there is no real alternative at the moment.

but "poor performance" compared to what?

compared to zero inserts in the cached template?
yes of course.

compared to a not-cached template?
unlikely, but it depends on your whole application/setup.

maybe the person who said that has read the sourcecode how insert is implemented and it *looked* slow to him/her. but i'm sure he/she never benchmarked it.
maybe he/she got fooled by http-caching-headers that are sent when displaying cached-templates with no inserts, but are not sent, when the template contains inserts, since the template isn't considered cacheable (in a http-meaning) then.


okay i could imagine an alternative:
instead of $smarty->display("cached-template-with-inserts");

you can do
$source = $smarty->fetch("cached-template-without-insert")
then replace certain parts in $source by your dynamic contents.
then: echo $source.

but i don't think there will be that much difference in runtime to {insert}, that it's worth the effort Wink

greetings
messju
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
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