Bug #63666 [Opn->Csd]: Poor date() performance [PATCH]
Edit report at https://bugs.php.net/bug.php?id=63666&edit=1
ID: 63666
Updated by: stas@php.net
Reported by: njaguar at gmail dot com
Summary: Poor date() performance [PATCH]
-Status: Open
+Status: Closed
Type: Bug
Package: Performance problem
Operating System: any
PHP Version: 5.4.9
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=fd650ec93e15bbbc05542e4acdde13d1fd9bcf73
Log: fix bug #63666 - Poor date() performance
Previous Comments:
------------------------------------------------------------------------
[2012-12-02 00:50:20] njaguar at gmail dot com
Description:
------------
Full info here:
http://news.php.net/php.internals/64127
4.4.9 on old machine vs 5.4.9 on new machine:
date : 1.856 sec date : 2.111 sec
after patch (~20% performance increase):
date: 1.763 sec
* new machine is 2 to 200x faster than old machine, see link above for more details
Test script:
---------------
// common date output format
// use any preferred timing methods either within php, or externally time execution of the script
(eg, microtime(), etc) -- the former will be more accurate at isolating the date() function, overall
$c = 1000000;
for($i=0; $i<$c; $i++) date('F j, Y, g:i a', $now);
Expected result:
----------------
worse performance on stock builds, better when patch is applied -- still considerably slower than
4.4.9 version of date() and related, but is an improvement
Actual result:
--------------
By moving the frequently used iso fetching function into the switch statement, this prevents an
otherwise unnecessary step for other more common usages of date formatting.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63666&edit=1
Thread (2 messages)