简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM