eandrews737/benchmarker 问题修复 & 功能扩展

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

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

eandrews737/benchmarker

Composer 安装命令:

composer require eandrews737/benchmarker

包简介

Will Benchmark PHP Functions For Food

关键字:

README 文档

README

A PHP package that takes in an array of functions and gives the user a report that ranks the runtime performance of each one. So far the functions will be ranked by min, max or average times. The report is customizable and currently supports JSON, console printing or file printing.

Current Version:

0.1.0

Getting Started

Prerequisites

Requires PHP 8.1.2

Installing

This project is a composer package. To install this library to your project run:

composer require eandrews737/benchmarker

Find it on Packagist

Using the Project

To use the project simply install the package and add:

require 'vendor/eandrews737/benchmarker/src/benchmark.php';
use Benchmarker\Benchmarker;

Then make a call to the benchmark function on the benchmaker class. Example Call:

Benchmarker::benchmark(["function1", "function2"], 5, true, 'json');

Parameters

  • functions (required array) - Array of functions.
  • executionAmount (int) - Amount of times to test each function. Defaults to 1.
  • isAscSort (boolean) - Whether or not to arrange the info in an ascending or descending order. Defaults to ascending.
  • printStyle (string) - Printing format. Defaults to JSON.

See next section for more details about printStyle.

Reporter

Supported formats:

  • raw - returns an object containing arrays of the data
  • file - returns a formatted string of the data saved to a file called benchmark.txt
  • string - returns a formatted string of the data
  • json - returns the data is a JSON format

Running Tests

Unit testing for this project utilizes phpunit.

Unit Testing

Testing for this project requires consistent times. So a simple test would be comparing a very slow function against a fast one. The results should always be consistent 99% of the time.

Go into the tests folder and run the following command:

phpunit test.php

While in the root directory, of course.

Built With

Authors

ME

License

This project is licensed under the MIT License - see the LICENSE.md file for details

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2019-06-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固