Download the PHP package eandrews737/benchmarker without Composer
On this page you can find all versions of the php package eandrews737/benchmarker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eandrews737/benchmarker
More information about eandrews737/benchmarker
Files in eandrews737/benchmarker
Package benchmarker
Short Description Will Benchmark PHP Functions For Food
License
Homepage https://github.com/eandrews737
Informations about the package benchmarker
PHP Function Benchmarker
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:
Getting Started
Prerequisites
Installing
This project is a composer
package.
To install this library to your project run:
Using the Project
To use the project simply install the package and add:
Then make a call to the benchmark function on the benchmaker class. Example Call:
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 ASC or DESC. Defaults to ASC.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 datafile
- returns a formatted string of the data saved to a file called benchmark.txtstring
- returns a formatted string of the datajson
- 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:
While in the root directory, of course.
Built With
Authors
License
This project is licensed under the MIT License - see the LICENSE.md file for details