Created
January 14, 2022 18:06
-
-
Save martinbutt/629293e2243675ab166ee2049c70e43f to your computer and use it in GitHub Desktop.
Phake memory test
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 | |
include("vendor/autoload.php"); | |
class ClassWithStaticMethod { | |
public static function staticMethod(): string | |
{ | |
return "hello"; | |
} | |
public function callingStaticWithStaticAccessor(): string | |
{ | |
return static::staticMethod(); | |
} | |
} | |
for ($i=0; $i<10000; $i++) { | |
$objs[] = \Phake::partialMock(ClassWithStaticMethod::class); | |
} | |
echo "Memory allocated: ".memory_get_peak_usage().PHP_EOL; | |
echo "Memory used: ".memory_get_peak_usage(true).PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment