in reply to Regarding speed: Is elsif or just if faster?

It depends a lot on what you do instead and how many cases you have to deal with. Aranging nested if statements into a binary search may speed things up a little at a huge cost in maintenance. Using a hash to dispatch to handlers rather than a bunch of if statements can have a big pay off in both execution time and maintenance if there are a huge number of cases. If there are only a small number of cases write it so it is most easily maintained - that is generally a much bigger win than shaving a few nanoseconds.


DWIM is Perl's answer to Gödel
  • Comment on Re: Regarding speed: Is elsif or just if faster?