php - Increasing the number of iterations of a simple loop by 1 significantly increases execution time -
i need figure out situation webserver regarding execution time. i've noticed problem when server returns higher number of characters ~41000 - around 40kb.
so did script:
<?php $php_start_time = microtime(true); echo $_get['i'].':'; for($i=0;$i<=$_get['i'];$i++) { echo 'a'; } echo '<br>runtime: '.(microtime(true) - $php_start_time); ?> and try out, more 10 times each, multiple browsers:
when $_get['i']=40952 around 0.013...ms
when $_get['i']=40953 around 0.679...ms
a difference of 0.666 1 single char?
i saw runtime differs lot when trying page results different locations (online proxy).
so suppose has distances. i'm in eu, server in us.
until find way fix issue script available at: http://selfreveal.com/speed_test_1.php?i=40953
also phpinfo(): http://selfreveal.com/phpinfo.php
my first guess you're running memory limit , garbage collector kicking in. try increasing memory limit:
ini_set('memory_limit'. '128m');
Comments
Post a Comment