asika/simple-benchmark 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

asika/simple-benchmark

最新稳定版本:3.1.0

Composer 安装命令:

composer require asika/simple-benchmark

包简介

PHP Simple Benchmark framework

README 文档

README

Installation via Composer

composer global require asika/simple-benchmark

Getting Started

Type benchmark or sb in terminal.

sb

The output will be:

PHP Simple Benchmark Framework - version: 2.0.0-beta
------------------------------------------------------------

[sb Help]

Help of Simple Benchmark.

Usage:
  sb <command> [option]


Options:

  -h | --help       Display this help message.
  -q | --quiet      Do not output any message.
  -v | --verbose    Increase the verbosity of messages.
  --ansi            Set 'off' to suppress ANSI colors on unsupported terminals.

Commands:

  run       Run benchmark
  create    Create a task file.

Use `benchmark create TaskName` to generate a new task sample file to /tasks folder.

Use `benchmark run TaskFile.php [times]` to run benchmark

Create a Task File

sb create TaskName

A file named TaskName.php will be generated to current folder.

Open TaskName.php you will see:

<?php

/** @var \SimpleBenchmark\Benchmark $benchmark */

You can do your benchmark by addTask().

<?php

/** @var \SimpleBenchmark\Benchmark $benchmark */
$benchmark->addTask('task1-md5', function() {
    md5(uniqid());
});

$benchmark->addTask('task2-sha1', function() {
    sha1(uniqid());
});

Run Benchmark

Run benchmark by this command:

sb run TaskName.php

The output will be:

Benchmark Result
---------------------------------------------
Run 10,000 times

task1-md5:
  - Time: 0.0104s
  - Memory: 2048kb

task2-sha1:
  - Time: 0.0101s
  - Memory: 2048kb

You can set times (Default is 10000) at second argument:

php benchmark run TaskName.php 15000

统计信息

  • 总下载量: 1.11k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-04