-
-
Save Danack/845a1913746a7e136d5d to your computer and use it in GitHub Desktop.
Loop test to check memory usage.
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 | |
$autoloader = require __DIR__.'/../vendor/autoload.php'; | |
$artaxClient = new Amp\Artax\Client; | |
$previous = 0; | |
for ($x=0 ; $x<400 ; $x++) { | |
$promises = []; | |
$randomWord = md5(md5(time()).$x); | |
//$request = "https://www.google.co.uk/search?q=".$randomWord; | |
$request = "https://www.bing.com/search?q=".$randomWord; | |
$promise = $artaxClient->request($request); | |
$response = $promise->wait(); | |
$memUsage = memory_get_usage(); | |
echo "Memory current: ".$memUsage;//.", peak: ".memory_get_peak_usage(); | |
if ($previous) { | |
echo " diff:".($memUsage - $previous); | |
} | |
echo "\n"; | |
$previous = $memUsage; | |
} | |
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
Memory current: 2765928 | |
Memory current: 2850744 diff:84816 | |
Memory current: 2927920 diff:77176 | |
Memory current: 3002664 diff:74744 | |
Memory current: 3078192 diff:75528 | |
Memory current: 3155176 diff:76984 | |
Memory current: 3232184 diff:77008 | |
Memory current: 3309064 diff:76880 | |
Memory current: 3385352 diff:76288 | |
Memory current: 3462096 diff:76744 | |
Memory current: 3538608 diff:76512 | |
Memory current: 3613680 diff:75072 | |
Memory current: 3689456 diff:75776 | |
Memory current: 3765008 diff:75552 | |
Memory current: 3842104 diff:77096 | |
Memory current: 3919384 diff:77280 | |
Memory current: 3996064 diff:76680 | |
Memory current: 4072880 diff:76816 | |
Memory current: 4147008 diff:74128 | |
Memory current: 4223584 diff:76576 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment