Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Two things you can do. place Microtime calls everywhere although its not convenient if you want to test more than one function. So there is a simpler way to do it a better solution if you want to test many functions which i assume you would like to do. just have a class (click on link to follow tutorial) where you can test how long all your functions take. Rather than place microtime everywhere. you just use this class. which is very convenient</p> <p><a href="http://codeaid.net/php/calculate-script-execution-time-%28php-class%29" rel="nofollow">http://codeaid.net/php/calculate-script-execution-time-%28php-class%29</a></p> <p>the second thing you can do is to optimize your script is by taking a look at the memory usage. By observing the memory usage of your scripts, you may be able optimize your code better.</p> <p>PHP has a garbage collector and a pretty complex memory manager. The amount of memory being used by your script. can go up and down during the execution of a script. To get the current memory usage, we can use the memory_get_usage() function, and to get the highest amount of memory used at any point, we can use the memory_get_peak_usage() function. view plaincopy to clipboardprint?</p> <pre><code> echo "Initial: ".memory_get_usage()." bytes \n"; /* prints Initial: 361400 bytes */ // let's use up some memory for ($i = 0; $i &lt; 100000; $i++) { $array []= md5($i); } // let's remove half of the array for ($i = 0; $i &lt; 100000; $i++) { unset($array[$i]); } echo "Final: ".memory_get_usage()." bytes \n"; /* prints Final: 885912 bytes */ echo "Peak: ".memory_get_peak_usage()." bytes \n"; /* prints Peak: 13687072 bytes */ </code></pre> <p><a href="http://net.tutsplus.com/tutorials/php/9-useful-php-functions-and-features-you-need-to-know/" rel="nofollow">http://net.tutsplus.com/tutorials/php/9-useful-php-functions-and-features-you-need-to-know/</a></p> <p><strong>PK</strong></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload