Re: [PHP3] PHP Speed Optimization

From: Date: Mon, 24 Apr 2000 20:14:31 +0000
Subject: Re: [PHP3] PHP Speed Optimization
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-18155@lists.php.net to get a copy of this message
Jeff Strain wrote: > I have a Helpdesk Management Utility that I have written in PHP. It is over > 4 hundred lines of code. Tiny. ;-) > I was wondering to how to best optimize this. I > do have several lines of code that are repeated. My main questions are: > 1. How fast is a function contained with in a script. Slower in 3 than in 4. Always a bit slower, how much you care about the speed loss is up to you. 3 milliseconds is nothing, unless it happens 180 times per page.....in which case those 3 milliseconds are a nightmare. > 2. If a require is within an if statement is the code required only if > the if is true, or is it read on first scan of the document, and how fast is > a require. Requires are _always_ read. Use includes if you're worried about RAM overhead, or stick the native code in there. Requires execute a little faster because they're always in the page, but it slows down the page when you have unused requires. > 3. I am just curious because in today's world speed is needed, and if > someone lags for just a few seconds they can get frustrated and leave. Yup. Optimize if it lags. > 4. Is their a better way to speed up scripts. Try other code. Get a faster machine. Use a fast database engine. If you're using 3, upgrade to 4. > Right now the main problem with speed of the script is that it is still in > the development stage on my old laptop that has 32 megs of ram running > windows98, mssql server and pws. You have a slow OS, a slow web server, very little RAM.... check your scripts on a fast OS, fast web server, with PHP loaded as part of the server. It can make a world of difference. > The Microsoft products are a resource > hogs. I do want to know my options when I go to implement this. Apache. On *nix. Well, that's not your _only_ option, but it's certainly the most supported one, with the fastest speed options available, AFAIK. Anybody running PHP on a 32cpu box yet? > Also, where can I find Database performance information for MYSQL vs MSSQL > Server (as unbias as possible). Unbiased? Heh. Not gonna happen. But I'll try to provide as little bias as possible: MSSQL is a drain if your primary goal is fast, simple, lookups and inserts. That's because, as a database, MSSQL is designed to do much, much, more than mySQL. If you don't _need_ those features, they're getting in the way. Of course, MSSQL also is limited to slower machines and OS's, so for maximum growth and speed, you might want to look into a more portable engine anyways. If, however, you are limited to slower Win32 equipment, you really should bench _your_ data, with _your_ code. The problem with unbiased DB testing is that there are so many variables that objective results are near impossible to get, so you really have to test with *your* specific variables (fields, data types, lookup/insert routines, etc.).... Here's a general bench suite, showing where mySQL is good: http://www.mySQL.com/benchmark.html One way of reading benchmarks is to remind yourself that they are showcasing their best speeds, and hiding their worst. So as long as you only use the banchmarked features, your data will scream. ;-) Of course, if you need MSSQL features that mySQL doesn't have, then you're out of luck, without doing something like: a) Using the fast DB for the site input/reporting b) Using the robust DB for analysis, complex structures. There's no reason to only use one if your speeds and features require two, Heck, some of my websites are using mySQL, btree'd files, PostgreSQL, and LDAP data engines, all for *one* set of transactions.... SO use what you need, when you need it! -Bop -- Brought to you from boop!, the dual boot Linux/Win95 Compaq Presario 1625 laptop, currently running RedHat 6.1. Your bopping may vary.

« previous php.dev (#18155) next »