Re: Script's length, echo, and execution speed

From: Date: Sat, 23 Dec 2006 21:55:16 +0000
Subject: Re: Script's length, echo, and execution speed
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-246181@lists.php.net to get a copy of this message
Casey Chu wrote:
Yeah, try testing. Maybe something like this: <?php $form = "<form action=' ' method='post'><textarea name='code'></textarea><br /><button type='submit'>Execute</button></form>"; if ($_POST['code']) { echo "<div style='border: 1px'>"; $time_start = microtime_float(); eval($_POST['code']); $time_end = microtime_float(); echo "<br />Loading took: ". $time_end - $time_start. '</div>'; } echo "<div style='float: left'>$form</div>"; // Note: This script is extremely dangerous and is not tested. ?> I haven't been following this thread, so I don't know if this has been suggested...
If you can run a local server, IMO, xdebug is *the* way to go...xdebug2 has an excellent profiler built-in. You can use kcachegrind or wincachegrind to see some pretty mind-boggling detail about where your performance goes. It's much easier than inserting timing statements into existing code. jon

« previous php.general (#246181) next »