PHP 클래스 Lavoiesl\PhpBenchmark\Benchmark

파일 보기 프로젝트 열기: lavoiesl/php-benchmark 1 사용 예제들

공개 메소드들

메소드 설명
add ( string $name, Closure $closure ) : SimpleTest Utility method to create tests on the fly You may chain the test:
addTest ( AbstractTest $test )
formatResults ( array $results ) : array Format the results, rounding numbers, showing difference percentages and removing a flat time based on the benchmark overhead
guessCount ( float $max_seconds ) : integer Average the guessCount of each test, determining the best n
outputTable ( array $lines, integer $padding = 3 ) Output results in columns, padding right if values are string, left if numeric
run ( $output = true )
setCount ( $n )

비공개 메소드들

메소드 설명
warmup ( ) Runs an empty test to determine the benchmark overhead and run each test once

메소드 상세

add() 공개 메소드

Utility method to create tests on the fly You may chain the test:
public add ( string $name, Closure $closure ) : SimpleTest
$name string
$closure Closure function to execute
리턴 SimpleTest

addTest() 공개 메소드

public addTest ( AbstractTest $test )
$test AbstractTest

formatResults() 공개 메소드

Format the results, rounding numbers, showing difference percentages and removing a flat time based on the benchmark overhead
public formatResults ( array $results ) : array
$results array array($name => array('time' => 1.0))
리턴 array array(array('Test' => $name, 'Time' => '1000 ms', 'Perc' => '100 %'))

guessCount() 공개 메소드

Average the guessCount of each test, determining the best n
public guessCount ( float $max_seconds ) : integer
$max_seconds float
리턴 integer

outputTable() 공개 정적인 메소드

Output results in columns, padding right if values are string, left if numeric
public static outputTable ( array $lines, integer $padding = 3 )
$lines array array(array('Name' => 'Value'));
$padding integer space between columns

run() 공개 메소드

public run ( $output = true )

setCount() 공개 메소드

public setCount ( $n )