note 43965 added to ref.outcontrol

From: Date: Sat, 10 Jul 2004 09:53:03 +0000
Subject: note 43965 added to ref.outcontrol
Groups: php.notes 
Request: Send a blank email to php-notes+get-72979@lists.php.net to get a copy of this message
For those who are looking for optimization, try using buffered output. I noticed that an output function call (i.e echo()) is somehow time expensive. When using buffered output, only one output function call is made and it seems to be much faster. Try this : <?php your_benchmark_start_function(); for ($i = 0; $i < 5000; $i++) echo str_repeat ("your string blablabla bla bla", (rand() % 4) + 1)."<br>\n"; echo your_benchmark_end_function(); ?> And then : <?php your_benchmark_start_function(); ob_start (); for ($i = 0; $i < 5000; $i++) echo str_repeat ("your string blablabla bla bla", (rand() % 4) + 1)."<br>\n"; echo your_benchmark_end_function(); ob_end_flush (); ?> ---- Manual Page -- http://www.php.net/manual/en/ref.outcontrol.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43965 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43965&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43965&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#72979) next »