为什么我的分析/基准测试显示出比谷歌Chrome Devtool更好的性能

时间:2012-10-01 16:12:31

标签: php google-chrome solr benchmarking laravel

我正在对我的应用进行基准测试,以了解我在哪里提高网站的性能。我正在使用PHP框架Laravel并对Solr执行搜索。通过比较microtime()并使用Laravel的Profiler类记录来完成基准测试。

我的基准测试结果:

Start function                                         msec
Creating the query                                     2.50196456909 msec
Executing query and getting results (PHP & Solr)       37.4531745911 msec
    \->Executing query (as reported by Solr QTime)     21 msec
Processing Solr results                                11.666059494 msec

Chrome的“网络”标签

Latency time reported by Chrome:                       196ms

enter image description here

问题: Chrome([{1}})报告的时间与我记录的时间似乎有130毫秒(约300%)的差异。什么似乎导致了差异,我应该如何摆脱它?

我的基准测试中未包含的唯一内容是Waitingjson_encode()到浏览器之前return最终数组所花费的时间。

另外,我应该如何缩短connecting时间,为什么这么长?谢谢!

1 个答案:

答案 0 :(得分:1)

Chrome报告从请求点到浏览器渲染完成的基准测试,而Laravel Benchmark配置文件仅在服务器内报告。所以肯定会有所不同。