Re: Code optimization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> You're assuming that. It could be the queries being run are the costliest.

It has got nothing to do with the cost of query. bare mysql_connect()
is very costly.

compare
<?php
$time = microtime(true);
mysql_connect('localhost', 'user', 'pass');
//mysql_close();
echo (microtime(true) - $time) . "<br>\n";
$time = microtime(true);
mysql_connect('localhost', 'user', 'pass');
mysql_close();
echo (microtime(true) - $time);

with

<?php
$time = microtime(true);
mysql_connect('localhost', 'user', 'pass');
mysql_close();
echo (microtime(true) - $time) . "<br>\n";
$time = microtime(true);
mysql_connect('localhost', 'user', 'pass');
mysql_close();
echo (microtime(true) - $time);

to see the difference.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux