Performance -- Eval vs Include

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • */hack/*

    Performance -- Eval vs Include

    For those of you that have tested eval() vs. including a file many times,
    I'd appreciate your comments on which one is better for performance.
    My application will have a queue like routine in which I may have to include
    a file many time. The file will contain a series of switch/case statements.
    Depending on specified criteria, this file will need to be processed from
    one time up to X times. I am not really worried about the usual case where
    the file will be included less than 3-5 times in one request, however, above
    that I have to wonder where to save on performance.

    Those of you writing parsers are probably moreso in the know on this one,
    however, anyone else that has a clue please feel free to add your 2c.

    Thanks,

    -Laidbak


  • noSpam

    #2
    Re: Performance -- Eval vs Include

    */hack/* wrote:[color=blue]
    > For those of you that have tested eval() vs. including a file many times,
    > I'd appreciate your comments on which one is better for performance.
    > My application will have a queue like routine in which I may have to include
    > a file many time. The file will contain a series of switch/case statements.
    > Depending on specified criteria, this file will need to be processed from
    > one time up to X times. I am not really worried about the usual case where
    > the file will be included less than 3-5 times in one request, however, above
    > that I have to wonder where to save on performance.
    >
    > Those of you writing parsers are probably moreso in the know on this one,
    > however, anyone else that has a clue please feel free to add your 2c.
    >
    > Thanks,
    >
    > -Laidbak
    >
    >[/color]
    file operations are expensive - keep them to a minimum, mind you so is
    eval. Sounds like a design problem

    Comment

    • Michael Fesser

      #3
      Re: Performance -- Eval vs Include

      .oO(*/hack/*)
      [color=blue]
      >For those of you that have tested eval() vs. including a file many times,
      >I'd appreciate your comments on which one is better for performance.[/color]

      I try to avoid eval() whenever possible. Sometimes it may look like the
      most simple solution, but in most cases there's a much better and faster
      way to do something.
      [color=blue]
      >My application will have a queue like routine in which I may have to include
      >a file many time.[/color]

      The same file? Sounds bad. Including a file _one_ time is more than
      enough. Consider to use functions.

      Micha

      Comment

      Working...