PHP performance

前端 未结 13 2210
庸人自扰
庸人自扰 2020-12-28 19:03

What can I do to increase the performance/speed of my PHP scripts without installing software on my servers?

13条回答
  •  甜味超标
    2020-12-28 19:31

    1) Use latest version of PHP

    The core team is working hard on improving the performance of PHP in every version.

    2) Use a bytecode cache

    Since PHP 5.5 a bytecode cache has been added to PHP named OPcache. Using OPcache can make a huge difference especially since PHP 7. It receives improvements in every PHP version and might even get a JIT implementation in the future.

    3) Profiling

    While developing profiling gives you great insight what exactly is happening. This helps a lot finding bottlenecks in your code.

    One of the most used tools is XHProf but is not officially supported anymore and has issues with PHP >= 7. An alternative when you want to profile PHP >= 7 is Tideways which is a fork of XHProf.

提交回复
热议问题