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

fetch vs display

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


Joined: 14 May 2003
Posts: 29
Location: Bari, Italy

PostPosted: Sat May 31, 2003 9:59 pm    Post subject: fetch vs display Reply with quote

why my script are faster (0.5 - 1 sec.) if I use echo $smarty->fetch(..)instead of $smarty->display(...) ?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
mohrt
Administrator


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

PostPosted: Sat May 31, 2003 11:29 pm    Post subject: Reply with quote

Simply put, fetch() uses output buffering, display() does not. There was a discussion about this before, in the smarty-dev mailing list I think. It would seem at first that avoiding output buffering would speed things up, but in some situations the opposite may be true... such as with Apache and how it buffers its output.

If you are using Apache, try putting this in the httpd.conf:

Code:
SendBufferSize 65536


Or a size at least the average size of a web page from your server. This will force Apache to accumulate this amount of data to its output buffer before sending to the client, essentially what fetch() is doing for you at the application level anyways so no sense doing it again in Apache. Caution must be taken, this can have ill effects on low-memory systems (as would using fetch() on large output). Read the various Apache tuning guides for details.

Monte
Back to top
View user's profile Send private message Visit poster's website
gianni
Smarty Rookie


Joined: 14 May 2003
Posts: 29
Location: Bari, Italy

PostPosted: Sun Jun 01, 2003 5:46 am    Post subject: Reply with quote

Yes, my web server uses Apache but I can't change the httpd.conf
My pages aren't so large (the largest is 28k). May I use echo $smarty->fetch(..)?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
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