note 52652 added to function.ob-start
| From: | JM at osu1 dot php dot net | Date: | Sun, 08 May 2005 19:17:01 +0000 |
| Subject: | note 52652 added to function.ob-start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89127@lists.php.net to get a copy of this message | ||
I don't claim to understand this--I would have expected the exact opposite--but it seems that
ob_start() ... ob_end_flush()
can massively improve perfomance, by at least a factor of 10 (admittedly a small number of samples).
I tried this after discovering that I could move a large (100ms) bottleneck in one of my scripts
into
echo "<!-- about 40 characters of junk -->";
which clearly shouldn't have taken long to run.
My unfounded theory is that without buffering, the interaction between PHP4.3.4 and Apache is not
optimized, whereas with buffering, PHP delivers the entire page at once, which Apache handles
better.
I should add that this is under https.
----
Manual Page -- http://www.php.net/manual/en/function.ob-start.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52652
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52652&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52652&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52652&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52652&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52652&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52652&report=yes
Search -- http://master.php.net/manage/user-notes.php