Last active
December 26, 2015 03:29
-
-
Save puentesdiaz/7086714 to your computer and use it in GitHub Desktop.
test PHP array
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 | |
function ordenar($a) | |
{ | |
sort($a); | |
asort($a); | |
sort($a); | |
asort($a); | |
sort($a); | |
asort($a); | |
return sort($a); | |
} | |
function miCrypt($str) | |
{ | |
$b=""; | |
$a=md5($str); | |
if ($a !== '1f3870be274f6c49b3e31a0c6728957f') { | |
if (sha1($str) !== 'd0be2dc421be4fcd0172e5afceea3970e2f3d940') { | |
$b=sha1($a); | |
} | |
} | |
return $b; | |
} | |
function volcarCrypt($str) | |
{ | |
$z = miCrypt($str); | |
//echo $z; | |
//echo " <br> ";echo " <br> "; | |
} | |
function iterar($x,$a,$b) | |
{ | |
$z=0; | |
for($i=0;$i<$a;$i++) | |
{ | |
miCrypt($i); | |
$x[$i] = $i; | |
for($j=0;$j<$b;$j++) | |
{ | |
$z += $j; | |
} | |
} | |
unset($z); | |
return $x; | |
} | |
function microtime_float() | |
{ | |
list($usec, $sec) = explode(" ", microtime()); | |
return ((float)$usec + (float)$sec); | |
} | |
function medir() | |
{ | |
$a=microtime(true); | |
//echo $a." <br> "; | |
//echo " <br> ";echo " <br> "; | |
test(); | |
$b=microtime(true); | |
//echo $b." <br> "; | |
//echo " <br> ";echo " <br> "; | |
//echo " <br> ";echo " <br> "; | |
informe($b-$a); | |
} | |
function test() | |
{ | |
$arr = array(); | |
$arr=iterar($arr,50000,700); | |
ordenar($arr); | |
volcarCrypt(implode("", $arr)); | |
$arr=iterar($arr,50000,700); | |
ordenar($arr); | |
volcarCrypt(implode("", $arr)); | |
$arr=iterar($arr,50000,700); | |
ordenar($arr); | |
volcarCrypt(implode("", $arr)); | |
echo " <br> "; | |
} | |
function informe($r) | |
{ | |
echo " <br> ";echo " <br> "; | |
echo "PERFORMANCE ".($r); | |
$ipServer = $_SERVER['SERVER_NAME']; | |
$urlRootAPACHE = "http:\/\/" . $ipServer . "/"; | |
$urlRootHHVM = "http:\/\/" . $ipServer . ":8080/"; | |
echo " <br> "; | |
echo " <br> "; | |
echo " <br> "; | |
echo "APACHE + "; | |
echo "<a href='./opc.php' > OPCACHE </a>"; | |
echo " <br> "; | |
echo "<a href='" . $urlRootAPACHE . "test-fast.php' > TEST 1 </a>"; | |
echo " <br> "; | |
echo "<a href='" . $urlRootAPACHE . "test-fast-2.php' > TEST 2 </a>"; | |
echo " <br> "; | |
echo " <br> "; | |
echo " <br> "; | |
echo "HHVM "; | |
echo " <br> "; | |
echo "<a href='" . $urlRootHHVM . "test-fast.php' > TEST 1 </a>"; | |
echo " <br> "; | |
echo "<a href='" . $urlRootHHVM . "test-fast-2.php' > TEST 2 </a>"; | |
} | |
medir(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment