Last active
December 18, 2015 08:48
-
-
Save ackintosh/5756449 to your computer and use it in GitHub Desktop.
Benchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AnotherExample extends AbstractMarker | |
{ | |
// override | |
public function before() | |
{ | |
// runs before benchmarking | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"ackintosh/benchy": "dev-master" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Example extends AbstractMarker | |
{ | |
public function hoge() { 'fuga'; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
$reporter = Ackintosh\Benchy::run(function ($reporter) { | |
// do something | |
echo $reporter->time->elapsed() . PHP_EOL; | |
// do something | |
echo $reporter->time->elapsed() . PHP_EOL; | |
}, 1000); // runs 1,000 times.(default : 1 ) | |
echo 'total : ' . $reporter->time->total() . PHP_EOL; | |
echo 'average : ' . $reporter->time->average() . PHP_EOL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$reporter = Ackintosh\Benchy::run(function ($reporter) { | |
// do something | |
echo $reporter->example->hoge();// fuga | |
}); | |
echo $reporter->example->hoge();// fuga |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment