#39968 [NEW]: date() is extremely slow

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #39968 [NEW]: date() is extremely slow

    From: katzenmayer at erfnet dot de
    Operating system: Debian Sarge
    PHP version: 5.2.0
    PHP Bug Type: Performance problem
    Bug description: date() is extremely slow

    Description:
    ------------
    While switching a calendar script from PHP4 to PHP5 I noticed the script
    takes multiple times as long to complete in PHP5 than it did in PHP4.

    The problem seems to be date() and mktime() functions.

    I did not notice any other PHP5 related performance issues. Scripts that
    do not use date() or mktime() run very fast.

    Reproduce code:
    ---------------
    test.php:

    <?
    for ($i=0;$i<100000;$i++)
    {
    date('d');
    }
    ?>

    Now check this script with both PHP4 and PHP5:

    time php4 test.php
    time php5 test.php

    Expected result:
    ----------------
    The script should take about the same time in both PHP4 and PHP5

    Actual result:
    --------------
    time php4 test.php

    real 0m0.286s
    user 0m0.034s
    sys 0m0.252s

    time php5 test.php

    real 0m25.252s
    user 0m18.579s
    sys 0m5.615s


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

  2. Similar Questions and Discussions

    1. EXTREMELY slow file transfer HELP!
      I have a tremendous problem. I have about 15 sites that I developed and manage with Dreamweaver. For some reason the transfer rate for one of them...
    2. Net::SSH::Perl extremely slow?
      I have a simple perl script that connects to a remote machine and executes a command. Net::SSH::Perl seems etremely slow, but I've tried it on 2...
    3. Extremely Slow Printing in 6.01
      Thanks for your response. That doesn't seem to help though. Whereabouts are the "issues regarding post script vs. PCL" that you mention? ...
    4. Extremely Slow WebService
      My web service is running extrememly slow when consumed in Excel VBA (using MS Office XP Web Services toolkit to add a Web Reference to ws). I'm...
    5. Database is extremely slow
      I have an Oracle 7.3.4.4 database that is experiencing extremely slow response times in the past few days. I know that one of the tables had as...
  3. #2

    Default #39968 [Opn->Bgs]: date() is extremely slow

    ID: 39968
    Updated by: [email]iliaa@php.net[/email]
    Reported By: katzenmayer at erfnet dot de
    -Status: Open
    +Status: Bogus
    Bug Type: Performance problem
    Operating System: Debian Sarge
    PHP Version: 5.2.0
    New Comment:

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    You need to set the timezone, otherwise a notice is raised
    which is what's killing the speed of your code.


    Previous Comments:
    ------------------------------------------------------------------------

    [2006-12-27 22:32:23] katzenmayer at erfnet dot de

    Description:
    ------------
    While switching a calendar script from PHP4 to PHP5 I noticed the
    script takes multiple times as long to complete in PHP5 than it did in
    PHP4.

    The problem seems to be date() and mktime() functions.

    I did not notice any other PHP5 related performance issues. Scripts
    that do not use date() or mktime() run very fast.

    Reproduce code:
    ---------------
    test.php:

    <?
    for ($i=0;$i<100000;$i++)
    {
    date('d');
    }
    ?>

    Now check this script with both PHP4 and PHP5:

    time php4 test.php
    time php5 test.php

    Expected result:
    ----------------
    The script should take about the same time in both PHP4 and PHP5

    Actual result:
    --------------
    time php4 test.php

    real 0m0.286s
    user 0m0.034s
    sys 0m0.252s

    time php5 test.php

    real 0m25.252s
    user 0m18.579s
    sys 0m5.615s



    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39968&edit=1[/url]
    iliaa@php.net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139