Skip to content

Instantly share code, notes, and snippets.

@laruence
Created April 27, 2020 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laruence/df51017db658ee2c434e98574615b7d2 to your computer and use it in GitHub Desktop.
Save laruence/df51017db658ee2c434e98574615b7d2 to your computer and use it in GitHub Desktop.
<?php
function A() {
}
function Aaaa() {
}
function Aaaaaaaa() {
}
function Aaaaaaaaaaaaaaaa () {
}
function bench($func) {
$i = 0;
$start = microtime(true);
while ($i++ < 1000000) {
$func();
}
echo "calling $func using ", microtime(true) - $start, "s\n";
}
bench("A");
bench("Aaaa");
bench("Aaaaaaaa");
bench("Aaaaaaaaaaaaaaaa");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment