calgamo / bench
0.7.0
2019-10-23 21:48 UTC
Requires
- php: >=7.1
- calgamo/util: ~0.1
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpunit/phpunit: ^6.3.0
README
描述
Calgamo/Bench 是 calgamo 框架的基准测试库。
功能
演示
示例 1:时间基准简写
use Calgamo\Bench\TimeBenchmark; $handle = TimeBenchmark::start(); // benchmark target code here $score = TimeBenchmark::score($handle); echo 'score: ' . $score . ' msec';
示例 2:内存基准简写
use Calgamo\Bench\MemoryBenchmark; $handle = MemoryBenchmark::start(); // benchmark target code here $score = MemoryBenchmark::score($handle); $score = array_map(function($v){ return $v . 'MB'; }, $score); echo 'score: ' . print_r($score, true);
用法
要求
PHP 7.1 或更高版本
安装 calgamo/bench
推荐通过 Composer 安装 calgamo/bench。
composer require calgamo/bench
安装后,您需要引入 Composer 的自动加载器
require 'vendor/autoload.php';
许可
作者
免责声明
本软件不提供任何保证。
我们不承担因使用本软件而引起的任何结果的责任。
请自行承担责任。