承接 nochso/benchmark 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

nochso/benchmark

最新稳定版本:0.5.3

Composer 安装命令:

composer require --dev nochso/benchmark

包简介

Benchmark with reliable results

README 文档

README

Latest Stable Version License

nochso/benchmark creates pretty HTML benchmarks from any closures you supply:

  • Generate HTML reports including Github flavoured Markdown
  • Reliably compare different algorithms
  • Run tests for a minimum amount of time to ensure stable results

View an example report

View the API documentation

Installation

  1. Install composer on Linux / Unix / OSX or Windows

  2. Require this package via composer:

    composer require nochso/benchmark

Usage

Have a look at the example reports.

A very simple example without parameters:

$report = new Report('My report name');
$unit = new Unit('Encryption speed');
$unit->addClosure(function ($n) {
    while ($n--) {
        $x = str_rot13('secret');
    }
}, 'rot13');
$unit->addClosure(function ($n) {
    while ($n--) {
        $x = str_rot13(str_rot13('secret'));
    }
}, 'rot26');
$report->unitList->add($unit);
$report->run();

This will generate and save a HTML report to folder build by default.

Options

The Report constructor takes an optional third argument $config:

public function __construct($title, $description = '', $config = array())

If omitted, default options will be used. Otherwise your configuration will be merged with the defaults.

array(
    'template_dir' => 'template',
    'output_dir'   => 'build',
    'twig'         => array(
        'cache'            => 'cache/twig',
        'auto_reload'      => true,
        'strict_variables' => true,
    ),
)

You can also change the minimum duration of tests which defaults to 1000 millseconds (1 second):

\nochso\Benchmark\Timer::$defaultMinDuration = 1000;

Contributing

  1. Open an issue if it's worth discussing.
  2. Fork this project on Github.
  3. Clone your fork: git clone git@github.com:yourname/benchmark.git
  4. Don't forget to composer update
  5. Create your feature branch: git checkout -b my-new-feature
  6. Commit your changes: git commit -am 'Add some feature'
  7. Push to the branch: git push origin my-new-feature
  8. Submit a pull request on Github :)

Change log

See CHANGELOG.

Credits

License

This project is licensed under the ISC license which is MIT/GPL compatible and FSF/OSI approved:

Copyright (c) 2015, Marcel Voigt <mv@noch.so>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: ISC
  • 更新时间: 2015-09-25