in reply to Re: Goto out of Sub - Re: Re: Simple Switch statement
in thread Simple Switch statement

Regarding the if/elsif/else comments: I agree. When coding in ASM and 'C', I would always put the highest frequency items first in the chain for performance reasons. It just seems logical that it would apply to any language.

Also, a long time ago, I found that there was a sort of critical mass, if you will, at which point one method was faster than the other. Below that point if/else or cmp/jne etc. was the way to go, the methods were comparable at or near that point, and switch case/jump table was to prefered method over that critical mass.

Now, things have changed, compilers and processors, so I don't know how much that holds true today. I don't write drivers any more so I just don't think about it ;-)

  • Comment on Re: Re: Goto out of Sub - Re: Re: Simple Switch statement

Replies are listed 'Best First'.
Re: Re: Re: Goto out of Sub - Re: Re: Simple Switch statement
by liz (Monsignor) on Sep 14, 2003 at 15:28 UTC
    ...things have changed, compilers and processors, so I don't know how much that holds true today.

    Which was exactly why I wrote my first meditation. I think the consensus was that at the Perl level, you're so "macro" already that all of the optimizations you go for are drowned out by the "noise" that Perl creates.

    Liz