how to increase the speed of a script

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
php-forum Active User
php-forum Active User
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

Tue Aug 27, 2002 7:11 am

is anybody knws how to increase the speed of a php page...

i mean which factors ...

php-forum Fan User
php-forum Fan User
Posts: 67
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA

Tue Aug 27, 2002 7:18 am

The only real part you can control is how fast the PHP is rendered (or parsed) and sent back... you can control net congestion and other factors like that.

The best way would be to run a serious of test (ie run your script many many times) with debugging code telling you how long certain parts of your script take (in ms). Try to get the times as low as possible (obviously). Once you see a large number, focus on part of your script and re-think your logic and ways to make it better. The best places to do this (imo) would be at the beginning and ends of loops. See how long the loop takes on certain conditions. Attempt to run the loop as least times as possible (even if it takes an extra variable or two). You can search the net for information on better algorithms on how to do certain things (depending on what you are doing exactly).

That is what I use in my programming to optimize my scripts. Getting input from other people and seeing what works best is the best way (imo).

Hope this helps


Tue Aug 27, 2002 11:01 am

Learn to compact your coding, make efficient functions and loops, and if you've got access to your server you can install PHP Accelerator
Post Reply