Method | Description | |
---|---|---|
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 ) |
Method | Description | |
---|---|---|
warmup ( ) | Runs an empty test to determine the benchmark overhead and run each test once |
public add ( string $name, Closure $closure ) : SimpleTest | ||
$name | string | |
$closure | Closure | function to execute |
return | SimpleTest |
public formatResults ( array $results ) : array | ||
$results | array | array($name => array('time' => 1.0)) |
return | array | array(array('Test' => $name, 'Time' => '1000 ms', 'Perc' => '100 %')) |
public guessCount ( float $max_seconds ) : integer | ||
$max_seconds | float | |
return | integer |
public static outputTable ( array $lines, integer $padding = 3 ) | ||
$lines | array | array(array('Name' => 'Value')); |
$padding | integer | space between columns |