文章分类 -  性能测试

php 普通错误和致命错误捕获及处理
摘要:值 常量 描述 1 E_ERROR 致命的运行错误。错误无法恢复,暂停执行脚本。 2 E_WARNING 运行时警告(非致命性错误)。非致命的运行错误,脚本执行不会停止。 4 E_PARSE 编译时解析错误。解析错误只由分析器产生。 8 E_NOTICE 运行时提醒(这些经常是你代码中的bug引起的 阅读全文

posted @ 2017-08-08 17:42 小乔流水人家 阅读(343) 评论(0) 推荐(0)

php xdebug之性能调试
摘要:Xdebug是一个开放源代码的PHP程序调试器(即一个Debug工具),可以用来跟踪,调试和分析PHP程序的运行状况。Xdebug现在的最新版本是Xdebug 2.4.0RC4,release日期 2016-01-25,添加了对PHP7的支持。 1.Xdebug安装 下载xdebug XDebug 阅读全文

posted @ 2017-08-08 16:41 小乔流水人家 阅读(1585) 评论(0) 推荐(0)

PHP 循环迭代 代替 递归
摘要:set_time_limit(1200); ini_set('memory_limit', '1024M'); class PerformanceTest { private $time; private $memory; public function begin() { $this->time = $this->getTime(); ... 阅读全文

posted @ 2017-08-01 15:35 小乔流水人家 阅读(601) 评论(0) 推荐(0)

50个PHP程序性能优化的方法
摘要:程序的执行效率很重要,低的执行效率意味着你需要在服务器硬件上有更多的投入,但是,最终的结果会因为你的程序执行效率低,连硬件也无法解决。下面几十个提高程序执行效率的小知识就有必要了解了解了。 1、 用单引号代替双引号来包含字符串,这样做会更快一些。因为 PHP 会在双引号包围的 字符串中搜寻变量,单引 阅读全文

posted @ 2017-07-27 16:15 小乔流水人家 阅读(87) 评论(0) 推荐(0)

PHP 存储性能 每次迭代间数据最好不想关 这样才能发挥处理器的流水线和并行
摘要:function write_read(&$src,&$dst,$n) { $cnt = $n; $val = 0; while($cnt) { $dst = $val; $val = ($src) + 1; $cnt--; } } $loop = 0; $count = 0; $a = new Pe... 阅读全文

posted @ 2017-07-17 12:09 小乔流水人家 阅读(93) 评论(0) 推荐(0)

PHP 碰到不确定预测 条件分支预测错误会有性能惩罚 使用条件传送更好
摘要:function minmax1(array $a,array $b,int $n) { for($i=0;$i$b[i]) { $t = $a[i]; $a[$i] = $b[$i]; $b[$i] = $t; } } } function minmax2(ar... 阅读全文

posted @ 2017-07-17 11:30 小乔流水人家 阅读(244) 评论(0) 推荐(0)

PHP 最小化一个计算中的操作数不一定会提高它的性能?? 和 本身操作最好用+= 或者 *= /=
摘要:set_time_limit(1200); class PerformanceTest { private $time; private $memory; public function begin() { $this->time = $this->getTime(); $this->memory = $this->g... 阅读全文

posted @ 2017-07-14 12:06 小乔流水人家 阅读(165) 评论(0) 推荐(0)

php 如何高效循环 最好不要频繁操作函数 传来的引用参数最好有个中间值(总是反复读写内存)
摘要:function buildData(int $len){ $ret = []; if($len>0) { $ret['len'] = $len; for($i=0;$i<$len;$i++) { $ret['data'][] = mt_rand(1,2); } } return $ret;} de 阅读全文

posted @ 2017-07-12 18:32 小乔流水人家 阅读(349) 评论(0) 推荐(0)

php switch 和 ifelseifelseif 相差不大
摘要:set_time_limit(1200); class PerformanceTest { private $time; private $memory; public function begin() { $this->time = $this->getTime(); $this->memory = $this->getMe... 阅读全文

posted @ 2017-06-10 15:27 小乔流水人家 阅读(179) 评论(0) 推荐(0)

php ifOrifelse
摘要:set_time_limit(1200); class PerformanceTest { private $time; private $memory; public function begin() { $this->time = $this->getTime(); $this->memory = $this->getMe... 阅读全文

posted @ 2017-06-10 15:11 小乔流水人家 阅读(128) 评论(0) 推荐(0)

php 类型转换之对象转数组 (array) 和 json_encode json_decode
摘要:json 需要操作太多 明显劣势于 (array) 阅读全文

posted @ 2017-04-27 15:22 小乔流水人家 阅读(133) 评论(0) 推荐(0)

php 复制文件之copy 和 file_get_content file_put_content 相差不大 但是后者需要格外内存资源
摘要:copy 可以省内存 阅读全文

posted @ 2017-04-27 15:18 小乔流水人家 阅读(551) 评论(0) 推荐(0)

php 判断是否存在数组中 isset 和 in_array
摘要:百万条一下没有区别 之上isset效率更高 阅读全文

posted @ 2017-04-27 15:16 小乔流水人家 阅读(385) 评论(0) 推荐(0)

程序占用资源和耗时
摘要:时间 内存 阅读全文

posted @ 2016-10-21 11:06 小乔流水人家 阅读(160) 评论(0) 推荐(0)

ab工具使用(测试平台的并发性能)
摘要:Apache -- ab工具主要测试网站的(并发性能) 这个工具非常的强大。 基本语法 : cmd>ab.exe –n 请求总次数 -c 并发数 请求页面的url 进入到ab.exe目录 举例: cmd>ab.exe –n 10000 –c 100 http://localhost/test.php 阅读全文

posted @ 2016-10-21 11:02 小乔流水人家 阅读(116) 评论(0) 推荐(0)

导航