You should try benchmarking your script and finding where the bottleneck is in the script.
The bottleneck is ussually in the database so you should have super optimized queries. Use MySQLi(MySQL Improved) or PDO which is much faster and prepared statements for security and caching of queries (
http://php.net/manual/en/mysqlnd-qc....rt.caching.php).
What will help you a lot in benchmarking is the
microtime() or XDebug tool(
http://xdebug.org/docs/profiler).
PHP Code:
$start_time = microtime(TRUE);
//The Query you want to test
$end_time = microtime(TRUE);
echo "Query 1 took : ". $end_time - $start_time."microseconds";