phpbench.com
域名年龄: 16年11个月14天HTTP/1.1 200 OK 访问时间:2016年12月08日 11:03:45 类型:text/html Transfer-Encoding: chunked 连接:keep-alive 设置Cookie:__cfduid=ddc3b6c299839dedb741a93efc3d48b671481166225; expires=Fri, 08-Dec-17 03:03:45 GMT; path=/; domain=.phpbench.com; HttpOnly 语言环境:PHP/5.5.9-1ubuntu4.11 动作:Accept-Encoding 服务器:cloudflare-nginx CF-RAY: 30dcfc6c6050513a-SJC Content-Encoding: gzip 页面编码:UTF-8
The PHP Benchmarksetting the record straightPHPBench.com was constructed as a way to open people's eyes to the fact that not every PHP code snippet will run at the same speed. You may be surprised at the results that this page generates, but that is ok. This page was also created so that you would be able to find discovery in these statistics and then maybe re-run these tests in your own server environment to play around with this idea yourself, by using the code examples (these code examples are automatically generated and as the code in my .php files change, so do they). NOTE: You must keep in mind to refresh this page a few times to "catch" the right result. The numbers change sometimes drastically during each refresh. I assume that this is because of PHP's memory garbage collector that drops in randomly and also other processes that run on this machine have an influence.NOTE: The microtime() method for testing out these tests has only been utilised for simplicities sake. If anything more advanced was used, those whom are just starting out on their PHP journey would have difficulties understanding.Variable Type CheckingisSet() vs. empty() vs. is_array()What is the performance of isSet() and empty(). Call 2'000x+ 117 %isSet() with var that was setTotal time: 55 µsview code+ 113 %empty() with var that was setTotal time: 53 µsview code+ 109 %isSet() with var that was *not* setTotal time: 51 µsview code+ 132 %empty() with var that was *not* setTotal time: 62 µsview code+ 132 %isSet() with array-var that was setTotal time: 62 µsview code+ 111 %empty() with array-var that was setTotal time: 52 µsview code+ 100 %isSet() with array-var that was *not* setTotal time: 47 µsview code+ 103 %empty() with array-var that was *not* setTotal time: 48 µsview code+ 392 %is_array() of an arrayTotal time: 184 µsview code+ 390 %is_array() of a stringTotal time: 183 µsview code+ 1342 %is_array() of a non set valueTotal time: 630 µsview code+ 1492 %isSet() AND is_array() of a non set valueTotal time: 701 µsview codeConclusion:isSet() and empty() are identical. So alway check if val is set at all befor using type-checking. E.g. if (isSet($foo) AND is_array($foo))Using the &-ref-operator...as a so called "alias"Is a good idea to use the &-ref-operator to substitute (or alias) a complex mutidim-array? . Call 1'000xE.g. $person = &$aHach["country"]["zip"]["street"]["number"]["name"]+ 195 %$alias = $aSingleDimArray[$i]Total time: 269 µsview code+ 100 %$alias = &$aSingleDimArray[$i]Total time: 138 µsview code+ 246 %$alias = $aMultiDimArray[$i]["aaaaa"]["aaaaaaaaaa"]Total time: 339 µsview code+ 321 %$alias = &$aMultiDimArray[$i]["aaaaa"]["aaaaaaaaaa"]Total time: 443 µsview code+ 226 %$alias = veryMultiDimArray[$i]["a"]["aa"]["aaa"]["aaaa"]["aaaaa"]Total time: 311 µsview code+ 604 %$alias = &$veryMultiDimArray[$i]["a"]["aa"]["aaa"]["aaaa"]["aaaaa"]Total time: 833 µsview
© 2010 - 2020 网站综合信息查询 同IP网站查询 相关类似网站查询 网站备案查询网站地图 最新查询 最近更新 优秀网站 热门网站 全部网站 同IP查询 备案查询
2025-04-10 18:53, Process in 0.0076 second.