Skip to content

Instantly share code, notes, and snippets.

@SelrahcD
Created January 22, 2015 10:00
Show Gist options
  • Save SelrahcD/c5d4f03b61860ecb174e to your computer and use it in GitHub Desktop.
Save SelrahcD/c5d4f03b61860ecb174e to your computer and use it in GitHub Desktop.
Perf test method
function test($closure, $name = null, $loop = 1000000) {
$start = microtime(true);
for($i = 0; $i < $loop; $i++) {
$closure();
}
$time = microtime(true) - $start;
if($name) {
echo $name . ' : ';
}
echo $time . ' ms for ' . $loop . ' iterations' . PHP_EOL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment