kevinlebrun/benchmark

我的小型基准库

1.0 2017-03-10 15:31 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:42:26 UTC


README

Build Status

这是我的一个小型PHP基准库。

用法

查看 example.php 文件。

$echo = Benchmark::run(function ($b) {
    for ($i = 0; $i < $b->getN(); $i++) {
        echo "Something";
    }
}, 'echo');
$present($echo);

$sleep = Benchmark::run(function ($b) {
    sleep(2);

    // You can reset the timer in case of heavy bootstraping code
    $b->reset();
    for ($i = 0; $i < $b->getN(); $i++) {
        echo "Something";
    }
}, 'echo with bootstraping code');
$present($sleep);

安装

强烈建议使用 composer 进行安装。

{
    "require": {
        "kevinlebrun/benchmark": "1.*"
    }
}
$ php composer.phar install

贡献

安装开发依赖

$ php composer.phar install --dev

所有测试必须通过

$ vendor/bin/phpunit -c phpunit.xml

必须遵循代码风格规范

$ vendor/bin/phpcs --standard=phpcs.xml -p .

许可证

(MIT许可证)