Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Efficiency of multiple if statements

by petdance (Parson)
on May 09, 2001 at 09:23 UTC ( #79023=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79023]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2021-04-14 01:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?