There are times when you’re working on a project and you need to test a page’s load overhead. For instance, if you have a lot of database calls or are using some crazy regex kung fu. These two little snippets of PHP code will give you a start to finish execution time of the page you’re loading up. Put the first one at the very top and the second one at the very bottom and load it up. When the page is finished rendering, just view source and you can see the execution time in the HTML comment. You can remove the comment if you want it to echo straight to your page. If you leave it in the comments, you can deploy this in a production page and monitor the load times whenever you feel like it. This goes at the top: <?php ereg(“(\.[0-9]+) ([0-9]+)”,microtime(),$time); $starttime = doubleval($time[1])+doubleval($time[2]); ?> […]
[Continue Reading...]
