From:             dor at videocells dot com
Operating system: Centos 5.2 64 bit
PHP version:      5.3.0
PHP Bug Type:     Performance problem
Bug description:  DateTimeZone::getTransitions performance drop

Description:
------------
Hi, it seems to me that the DateTimeZone::getTransitions() function
suffered a performance loss of some degree between php 5.2.9 and 5.3

each call to it takes about one tenth of a second.

I noticed this because I happen to have a function that recieves many
timezones and checks the transistions of each of them.
Recently I discovered a performance loss on my web gui, and after some
research i found out that for some reason the getTransitions() function
takes a noticable amount of time to run. much
more than with php 5.2.9 for the same request to complete.

note that since we worked with previous versions of php, it is called
without the new parameters added in php 5.3

Reproduce code:
---------------
$TimezonesToAdd = array (
        "(GMT -12:00) International Date Line West" => "Etc/GMT+12",    "(GMT
-11:00) Midway Island, Samoa" => "Pacific/Midway",
        "(GMT -10:00) Hawaii" => "US/Hawaii",
        // many many more time zones...
        "(GMT +12:00) Auckland, Wellington" => "Pacific/Auckland",
"(GMT +12:00) Fiji, Kamchatka, Marshall Is." => "Asia/Kamchatka",
        "(GMT +13:00) Nuku'alofa" => "Pacific/Tongatapu");
foreach ($TimezonesToAdd as $TimezoneDescription => $TimezoneID)
{
    EnsureTimezoneExists ($TimezoneID);
    self::$_AvailableTimezones [$TimezoneID] = $TimezoneDescription;
}
function EnsureTimezoneExists($TimezoneID)
{
    $res = timezone_open($TimezoneID)
    if($res)
    {
        $TimeInTimezone = new DateTime ("now",$res)
        //the following line takes alot of time :
        $trans = $res->getTransitions();
    }
}

Expected result:
----------------
The $res->getTransitions() call should cost in the magnitude of 0.001
seconds, but instead it takes about 0.1 seconds, which is noticable.

Actual result:
--------------
microtime() calls before and after the function call, show that the
function takes about 0.1 seconds to run

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

Reply via email to