Created
December 25, 2019 22:40
-
-
Save petermcd/0fcccc00469741bb523c30d62b49a6b1 to your computer and use it in GitHub Desktop.
Timing script for running pure PHP to compare against an extension written in C
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 | |
$lines = file('/home/peter/php-7.4.1/Zend/zend_language_parser.c'); | |
function string_reverse($input){ | |
$temp = ''; | |
for($iter = strlen($input);$iter > 0; $iter--){ | |
$temp = $temp . $input[$iter-1]; | |
} | |
return $temp; | |
} | |
$started = microtime(); | |
foreach ($lines as $line) { | |
string_reverse($line); | |
} | |
$ended = microtime(); | |
echo $ended - $started; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment