|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
gianni Smarty Rookie
Joined: 14 May 2003 Posts: 29 Location: Bari, Italy
|
Posted: Sat May 31, 2003 9:59 pm Post subject: fetch vs display |
|
|
why my script are faster (0.5 - 1 sec.) if I use echo $smarty->fetch(..)instead of $smarty->display(...) ? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Sat May 31, 2003 11:29 pm Post subject: |
|
|
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 |
|
gianni Smarty Rookie
Joined: 14 May 2003 Posts: 29 Location: Bari, Italy
|
Posted: Sun Jun 01, 2003 5:46 am Post subject: |
|
|
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 |
|
|
|
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
|