mcbeav
mcbeav

Reputation: 12275

PHP code optimization

I am just wondering what the best way to optimize PHP code is. Is there any way to compress PHP files, or would removing all of the white space improve performance. Any ways to improve performance in PHP files besides just the way you are writing functions?

Upvotes: 5

Views: 2284

Answers (1)

cdhowie
cdhowie

Reputation: 169403

If you are running on Apache, you can use eAccelerator, which will cache the compiled and optimized bytecode produced by the PHP parser, effectively removing the parsing step after the first hit to each script. On my blog's Wordpress install, this halves (!) the loading time of each page.

If you are trying to optimize the actual running time of your script, you will have to follow the standard wisdom: profile your code, find the bottlenecks, optimize them somehow, and repeat until the script is as fast as you need it to be.

Upvotes: 9

Related Questions