This file contains 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
// Benchmark params | |
$runs = 100000000; | |
// Gen test array | |
$strMatch = 'test string'; | |
echo 'Benchmark runs: ' . $runs . PHP_EOL; | |
// Benchmark isset | |
$timeStart = microtime(true); |
This file contains 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
// Benchmark params | |
$runs = 10000000; | |
// Gen test array | |
$testStr = 'string'; | |
$testInt = -100; | |
$testFloat = .1; | |
$testArr = [$testStr, 'key' => $testInt]; | |
$testObj = new \StdClass(); | |
$testObj->{0} = $testStr; |
This file contains 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
// Benchmark params | |
$arrLen = 100000; | |
$missRate = 10; | |
$runs = 10000000; | |
// Gen test array | |
$array = []; | |
for ($i = 0; $i < $arrLen; $i++) { | |
$array[$arrLen * $missRate + rand(0, $missRate)] = true; | |
} |