Gustavo,

1) Read the manual - though I can understand how you might have missed this:
http://us2.php.net/manual/en/function.microtime.php


Basically, there's a function based on microtime that does benchmarking. This is vital to timing your script. Use it extensively. If you're not sure where to start, break your script into chunks and figure out where most of your time is being spent.

2) Evaluate where time is being spent. If it's on database-access-bound portions, not a lot you can do from the PHP-end.

3) Evaluate the remainder of your code. In many tight loops (many iterations, not a lot of actual processing per iteration), particularly those modifying arrays, I get much better performance using while() or for() loops instead of foreach() generally. Obviously, this isn't always applicable, but I have found few ways to optimize GD image manipulations while I've found plenty for tight loops, so I'm only giving you suggestions on what I know.

4) Consider some overall performance enhancing stuff. Like the Zend Optimizer (free) which can sometimes help a lot, sometimes not at all. Also I'd say turckmmcache or something like that, but I'm pretty sure there's no Windows 98 version.

5) Evaluate your code. 160 KB (kilobytes, I'm assuming) is a pretty huge amount of PHP code for data replication. I hope that lots of it is content-type things and not all PHP commands, otherwise I would guess (though I could be wrong - some applications are very complex) that you are not coding efficiently. Very few of my projects even approach 160 KB of pure PHP, even things as massive as a complete online store creation and management application I developed not too long ago.

Good luck! Re-post to php-general if you have further questions!

-Galen

On Mar 27, 2004, at 1:43 PM, Luis Gustavo Faccioni Barcellos wrote:

Hi all.
I am developing a system using php 4.3.2 + apache 1.3.29. The db is a mssql msde (we’re going to mysql, but not yet due to some internal reasons). All things are running in a local, standalone station, because we had to use the app on line and off line states. The off-line one should have all stuff, so. It just connect to internet to send a data replication. The stations are windows 98.
The problem is: I have to run this stuff in small boxes, like some pentium 200mhz with 64-80mb ram, and in these machines the system is very slow. The html page takes about 70 seconds to be showed in the browser. I saw cpu and ram, and are all normal, even the mssql. Just the apache activity goes up to 70% cpu. We notice that while the php is running, anything happens and suddenly(after ~70 seconds) the page arises. Our php code is a kind of big, about 160kb, and the html is generated equally big. I am going to break the jscript stuff it in some small peaces, but will not help to much, I guess.
Well, if someboddy could point out me a way, a tip or a tool to discover what the script is doing while I am waiting its response, or just an ideia, I would really thank you.
Gustavo

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



Reply via email to