On Tue, Sep 22, 2009 at 4:03 AM, Mark Wieder <[email protected]> wrote:

>
> Actually there's no speed penalty for if/then vs switch constructs.
> They compile down to the same comparisons. If you're going to be
> applying the same tests repeatedly then you may find a negligible
> difference, but overall I wouldn't worry about this.
>
> Not precisely true. You may wish to look back at these two threads, lots of
benchmarking, sorry I haven't figured out how to create links to old threads
:-(

Subject: if statements vs case
Date: 27 feb 07
From: Hershel Fisch

Subject: switch case question
Date: 10/22/06
From: Mark Swindell

Basically, timings are similar BUT Dar Scott in the 2006 thread determined
those cases (sorry for the pun) where one will be faster than the other. I
believe the general conclusion was, if speed meant everything to you, you'd
need to benchmark both.

For Richmond, there is a simpler, cleaner option than complex CASE or IF
structures containing ever deepening embedded complex CASE or IF structures.
A single complex CASE structure (if it's complex I avoid IF structures)
containing many custom handlers. The custom handlers may then contain a
single complex CASE structure which may contain further custom handlers,
which may contain....., you get the picture.

General rule of thumb, if you spend more than a minute trying to match
IF/END IF, CASE/BREAK (or find yourself constantly using tRev's brilliant
Control Structure hilight feature) then it's probably time to Cut and Paste
some code into it's own custom handler.

HTH
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to