note 10472 deleted from features.persistent-connections by jimw
| From: | jimw@php.net | Date: | Tue, 18 Dec 2001 20:36:41 +0000 |
| Subject: | note 10472 deleted from features.persistent-connections by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23206@lists.php.net to get a copy of this message | ||
Test your potential speed increase! Here's a page I wrote:
<?
function microint()
{
$tmp = microtime();
$parts = explode(" ",$tmp);
$floattime = (float)$parts[0] + (float)$parts[1];
return $floattime;
}
$starttime = microint();
$connect = pg_pconnect("dbname=the_db user=the_user password=the_pw");
$endtime = microint();
$persistent = $endtime - $starttime;
$starttime = microint();
$connect = pg_connect("dbname=the_db user=the_user password=the_pw");
$endtime = microint();
$no_persistent = $endtime - $starttime;
echo "Without persistent connection, time was $no_persistent <br>";
echo "With persistent, time was $persistent <br>";
$percentage = $no_persistent / $persistent;
echo "This is $percentage times faster.";
?>
Don't let this be your only consideration, especially if both numbers are really small, but if
you're curious about the speed cost for non-persistent connections, this can help you out. Make
sure you refresh, too, because I found the times can vary.