Skip to content

Instantly share code, notes, and snippets.

@miio
Created December 5, 2013 01:31
Show Gist options
  • Save miio/7798738 to your computer and use it in GitHub Desktop.
Save miio/7798738 to your computer and use it in GitHub Desktop.
benchmark test
<?php
class A {
public function getA() {
return "A";
}
}
function getA() {
return "A";
}
$start_m = microtime();
$start = time();
$a = new A();
var_dump($a->getA());
$end_m = microtime();
$end = time();
$bench = ($end - $start) + ($end_m - $start_m);
var_dump($bench);
$ cat func.php
<?php
function getA() {
return "A";
}
$start_m = microtime();
$start = time();
var_dump(getA());
$end_m = microtime();
$end = time();
$bench = ($end - $start) + ($end_m - $start_m);
var_dump($bench);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment