What are some good PHP performance tips?

前端 未结 13 1767
挽巷
挽巷 2020-12-24 07:55

I\'ve heard of some performance tips for PHP such as using strtr() over str_replace() over preg_replace() depending on the situation.

13条回答
  •  甜味超标
    2020-12-24 08:03

    Usually pre-mature optimization is a veeeery bad idea. It really doesn't matter when you make your code run 0.5ms faster when single SQL query takes 80ms.

    You should profile code and focus on bottle necks and then try things like caching (static, APC, Memcached). Microoptimizations are the very last step when you've got perfect application design and still need more performance from certain modules/functions.

提交回复
热议问题