From:             jerico dot dev at gmail dot com
Operating system: Windows XP SP3
PHP version:      5.2.6
PHP Bug Type:     Performance problem
Bug description:  strtotime very much slower when operating on timestamp

Description:
------------
strtotime() performs 3 orders of magnitude slower when operating on a
timestamp.

Reproduce code:
---------------
$string = '1902-03-25 18:25:25';
$timestamp = strtotime($string); 

$mt0 = microtime(true);
$result1 = strtotime("$string +1 year");
$mt1 = microtime(true);
$result2 = strtotime("+1 year", $timestamp);
$mt2 = microtime(true);
printf("%.6f\r\n%.6f\r\n", $mt1-$mt0, $mt2-$mt1);

// This will output
// 0.000171
// 0.721877
// on my machine

Actual result:
--------------
see reproduce code

-- 
Edit bug report at http://bugs.php.net/?id=45409&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=45409&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=45409&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=45409&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=45409&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=45409&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=45409&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=45409&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=45409&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=45409&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=45409&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=45409&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=45409&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=45409&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=45409&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=45409&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=45409&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=45409&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=45409&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=45409&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=45409&r=mysqlcfg

Reply via email to