774530750 发表于 2018-12-22 15:18:57

php 优化

http://reinholdweber.com/?p=3  7 important for me:
  1. If a method can be static, declare it static. Speed improvement is by a factor of 4.
  2. Use echo’s multiple parameters instead of string concatenation.
  3. Set the maxvalue for your for-loops before and not in the loop.
  4. require_once() is expensive.
  5. strtr is faster than str_replace by a factor of 4.
  6. If you have very time consuming functions in your code, consider writing them as C extensions.
  7. Profile your code. A profiler shows you, which parts of your code consumes how many time. The Xdebug debugger already contains a profiler. Profiling shows you the bottlenecks in overview.

页: [1]
查看完整版本: php 优化