warnings and notices increase load time?

Discussion in 'PHP' started by xomero, Sep 19, 2008.

  1. #1
    if I use the functions:

    error_reporting(E_ALL);
    ini_set('display_errors', '1');

    shows me a lot of warnings and notices about the code like:

    Notice: Undefined index: l in /var/www/vhosts......
    Notice: Undefined index: s in /var/www/vhosts......
    Notice: Undefined index: a in /var/www/vhosts......
    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object....
    Notice: Use of undefined constant item - assumed 'item' in /var/www/vh.....

    and hundreds like that.

    This notices and warnings increase the load time of my scripts? So I have to correct this "warnings" on my code to get a better load time?

    I know I can correct almost all the Notices and Warnings, For example: "Notice: Undefined index: l" if I first check that the index "l" of the array exists before using this notice will disappear, but this will help to the load time?
     
    xomero, Sep 19, 2008 IP
  2. allaboutgeo

    allaboutgeo Peon

    Messages:
    85
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't think so.
     
    allaboutgeo, Sep 19, 2008 IP
  3. nabz245

    nabz245 Well-Known Member

    Messages:
    677
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    110
    #3
    If you have hundreds of warnings/notices it can cause the browser to take a small while longer to render the page, it shouldn't be too noticeable.
     
    nabz245, Sep 19, 2008 IP
  4. classic

    classic Peon

    Messages:
    96
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I guess by default all notices and warnings are logged to disk ( the slowest part of a server especially writes)
    so having large error/notice output will slow/increase load page / server load , and PHP engine needs to make some more CPU operations so either turn the them off or clean your code wich is better but can be also slower

    eg
    
    $name = $_POST['name'];
    
    //vs proper code
    $name = isset($_POST['name']) ? $_POST['name']  : '';
    
    PHP:
    As you see fore clean code, PHP needs to make if else statement and call "isset" function, vs just accessing an array value
     
    classic, Sep 19, 2008 IP