RE: [PHP] my php script is very slow. help?

From: Date: Fri, 27 Jul 2001 14:31:24 +0000
Subject: RE: [PHP] my php script is very slow. help?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-59951@lists.php.net to get a copy of this message
Be careful with any sort of nested loops. You may not be able to avoid them, but if you nest a while loop within another while loop, and simply iterate through results, you will have quadratic running time. This isn't a big deal if you've got 20 results, but for every increase in N (size of result) your running time will increase N^2. So, if you've got a large dataset, the process time will be enormous. Jack -----Original Message----- From: hassan xaaji [mailto:hxaaji@yahoo.co.uk] Sent: Friday, July 27, 2001 5:51 AM To: php-general@lists.php.net Subject: [PHP] my php script is very slow. help? Hi all I have Linux/PHP/MySQL. Some of my script really run very slowly. painfully slow. All data are fetched from the database. The tables in database are indexed. Still some scripts are very slow. I am using nested while and for loops. Any idea how to make them faster? What should I avoid in my scripting? thanks all ____________________________________________________________ Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#59951) next »