$cnt = 1000000;
$val1 = "fdasfdsafdsafdsa";
$val2 = null;
for ($i = 0; $i < $cnt; $i++) {
// warmup loop
$z = 1 + 1;
}
$st = getmicrotime();
print "warmup ".(getmicrotime() - $st)."\n";
$st = getmicrotime();
for ($i = 0; $i < $cnt; $i++) {
$x = is_null($val1);
$y = is_null($val2);
}
print "first test ".(getmicrotime() - $st)."\n";
$st = getmicrotime();
for ($i = 0; $i < $cnt; $i++) {
$x = !isset($val1);
$y = !isset($val2);
}
print "second test ".(getmicrotime() - $st)."\n";
exit;
warmup 2.0980834960938E-5
first test 0.19290900230408
second test 0.06994104385376
|