Created
February 21, 2014 17:24
-
-
Save jeffjrare/9138822 to your computer and use it in GitHub Desktop.
Array test
This file contains hidden or 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
Apc: 0.0036849975585938 seconds | |
Spl: 0.00083422660827637 seconds | |
Std: 0.00088095664978027 seconds |
This file contains hidden or 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 | |
/** | |
* | |
* PLEASE DONT DELETE THIS FILE | |
* | |
* @author jeffgirard | |
* | |
*/ | |
include "secret_includes/connect.php"; | |
//ini_set("memory_limit","800M"); | |
//set_time_limit(300); | |
// apc | |
$apcStart=microtime(true); | |
$arr=array(); | |
for ($i = 0; $i < 3000; $i++){ | |
$arr[] = $i; | |
} | |
apc_store('arr', $arr); | |
foreach(apc_fetch('arr') as $item){ | |
//echo $item; | |
} | |
echo "<br>Apc: ".(microtime(true)-$apcStart).' seconds<br><br>'; | |
// spl | |
$splStart=microtime(true); | |
$arr=new SplFixedArray(3000); | |
for ($i = 0; $i < 3000; $i++){ | |
$arr[$i] = $i; | |
} | |
foreach($arr as $item){ | |
//echo $item; | |
} | |
echo "<br>Spl: ".(microtime(true)-$splStart).' seconds<br><br>'; | |
// std | |
$stdStart=microtime(true); | |
$arr=array(); | |
for ($i = 0; $i < 3000; $i++){ | |
$arr[] = $i; | |
} | |
foreach($arr as $item){ | |
//echo $item; | |
} | |
echo "<br>Std: ".(microtime(true)-$stdStart).' seconds<br><br>'; | |
debug_output_full(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment