calgamo / bench

此包已被 弃用 并不再维护。作者建议使用 stk2k/bench 包。

Calgamo 框架的基准测试库。

0.7.0 2019-10-23 21:48 UTC

This package is auto-updated.

Last update: 2019-11-19 04:02:52 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Code Climate Total Downloads

描述

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';

许可

MIT

作者

stk2k

免责声明

本软件不提供任何保证。

我们不承担因使用本软件而引起的任何结果的责任。

请自行承担责任。