[PHP] Windows date(Y/m/d H:i:s) performance

2008-07-30 Thread Richard Lynch
I was profiling some code on my local dev box, and in Windows, the
biggest time sink for the home page is...

a call to date(Y/m/d H:i:s)?!
917 ms???

Here is what I get in a cygwin shell:
php -r '$c = 100; $s = microtime(true); for($i = 0; $i  $c; $i++){ $d
= date(Y/m/d H:i:s); } echo (microtime(true) - $s)/$c, \n; '
1.0072922205925

Same results from a DOS prompt, though I have to actually create a
file as -r didn't seem to work...

Feel free to change $c to 10 to get a faster answer...

Can 'date' really take almost a full second to execute in Doze?...

That seems pretty whack...

-- 
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Windows date(Y/m/d H:i:s) performance

2008-07-30 Thread Andrew Ballard
On Wed, Jul 30, 2008 at 12:11 PM, Richard Lynch [EMAIL PROTECTED] wrote:
 I was profiling some code on my local dev box, and in Windows, the
 biggest time sink for the home page is...

 a call to date(Y/m/d H:i:s)?!
 917 ms???

 Here is what I get in a cygwin shell:
 php -r '$c = 100; $s = microtime(true); for($i = 0; $i  $c; $i++){ $d
 = date(Y/m/d H:i:s); } echo (microtime(true) - $s)/$c, \n; '
 1.0072922205925

 Same results from a DOS prompt, though I have to actually create a
 file as -r didn't seem to work...

 Feel free to change $c to 10 to get a faster answer...

 Can 'date' really take almost a full second to execute in Doze?...

 That seems pretty whack...


I just ran your test code inside Zend Studio under Windows XP and it
printed 0.00044636011123657

Andrew

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php