1.
linux time方法测试php脚本执行效果
time php test.php
主要关注user执行消耗的时间
ab测试
xhprof测试
2.
vld扩展查看opcode执行情况
3.
合理使用内存,unset及时释放不适用的内存
4.
谨慎使用正则表达式
5.
不要在循环内部使用计算
6.
php不适合密集型运算和大数据量的处理
php语言是c来处理和运行的
php适合衔接webserver与后端服务,ui呈现(模板呈现,输出)
最近有php大并发,多进程服务
7.
数组应使用带引号的字符串作为key,不带引号php将字符串作为常量来处理
8.
网络请求设置超时时间
连接超时:200ms
读超时:800ms(不能超过1s)
写超时:500ms
9.
串行请求并行化
curl_multi_*()
swoole扩展
10.
opcode cache:opcache、apc等
底层c语言扩展
http://pecl.php.net/
-----