http://qs321.pair.com?node_id=79023


in reply to Efficiency of multiple if statements

Does it matter which is "more efficient"? Are you having a speed problem? Have you run anything thru Benchmark?

Dijkstra says "Premature optimization is the root of all evil". I would add the corrolary that "'Unnecessary' is, by definition, premature."

That aside, you can pretty easily figure out what makes most sense as your potential bottleneck. What I see is this:

  1. Check something out on disk
  2. Do a string check
  3. Do another string check
    And then
  4. Open another process that does a gzip

Where do you think the bottleneck would be? It's sure not gonna be items 2 or 3.

xoxo,
Andy

%_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
"hack";print map delete$_{$_},split//,q<   andy@petdance.com   >
  • Comment on Re: Efficiency of multiple if statements