Created
April 27, 2011 11:41
-
-
Save PJK/944108 to your computer and use it in GitHub Desktop.
Reference caching 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
<?php | |
require("class.php"); | |
$cache = $a->a->a; | |
for ($i=1; $i<=$loopcount; $i++) { | |
$cache->a; | |
} |
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 | |
class A { | |
public $prop; | |
} | |
$a = new A; | |
$a->a = new A; | |
$a->a->a = new A; | |
$a->a->a->a = "Ahoooj"; | |
$loopcount = 10e6; |
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 | |
require("class.php"); | |
for ($i=1; $i<=$loopcount; $i++) { | |
$a->a->a->a; | |
} |
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
$ time php -f direct.php | |
real 0m3.634s | |
user 0m3.640s | |
sys 0m0.000s | |
$ time php -f cache.php | |
real 0m2.037s | |
user 0m2.020s | |
sys 0m0.020s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment