fglueck/perf

本包的最新版本(0.1)没有提供许可信息。

简单的PHP性能测量类

0.1 2021-04-12 15:46 UTC

This package is auto-updated.

Last update: 2024-09-13 14:51:48 UTC


README

PHP性能比较测量类。

要生成基准报告

$p = new perf();
$p->start();
for($i=100000;$i;$i--) { -- checking performance of strrpos
    if(strrpos($string, ':'));
}
$p->stop('strrpos()');
$p->report();

->start()

初始化一个新的时间测量

->stap('label')

停止测量并设置标签

->report()

生成输出

输出示例

100.0% 0.37274s str_contains()
104.6% 0.38981s strpos(+pos)
105.1% 0.39162s strrpos(+pos)
108.7% 0.40509s strrpos()
112.6% 0.41980s [x]===':'
120.4% 0.44880s strpos()
143.9% 0.53623s substr_compare()
247.6% 0.92283s preg_match