Created
July 15, 2017 15:31
-
-
Save yu81/88fccee3fc27827a6f4d3c7f7b0ec0a9 to your computer and use it in GitHub Desktop.
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
<?php | |
// PHP 7.0.8 | |
$count = 1000000; | |
$start = microtime(true); | |
for($i = 0;$i < $count; $i++) { | |
preg_match("/^foo/", "foo"); | |
} | |
$end = microtime(true); | |
echo 1000000000 * (($end - $start) / $count) . " ns/op" . PHP_EOL; | |
// -> 200 ns/op 程度 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment