how to increase the speed of a script

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

cho@
New php-forum User
New php-forum User
Posts: 39
Joined: Tue Aug 06, 2002 8:58 am
Location: UK

how to increase the speed of a script

Postby cho@ » Tue Aug 27, 2002 7:11 am

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

i mean which factors ...


thx
cho@

elitecodex
New php-forum User
New php-forum User
Posts: 68
Joined: Tue Jul 09, 2002 8:45 am
Location: East Coast, USA
Contact:

Postby elitecodex » 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

Will

Jay

Postby Jay » 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


Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron