Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: Morpheus and IF

  1. #11


    Can't believe I missed a set of brackets.

    I did figure out using a waitframe if it looked like I'd drop straight through a loops.

    Generally I use switches if the context will require more than 3 if/else/whatever. Is there a certain point where switches will not show any improvement or is it just always better to use?

  2. #12
    Developer Todesengel's Avatar
    Join Date
    Dec 2013
    St. Louis, Missouri, USA


    Don't beat yourself up. I forget far more than just brackets every day.....

    Generally, in other languages, it is more efficient to interpret a case statement, or emit a jump table for one, than evaluate or emit code for a corresponding set of 'if' constructs, virtually regardless of the number of conditions since a switch only has one condition to evaluate. Simply put, I cant imagine a scenario where multiple comparisons against a constant wouldn't be less expensive than a full blown eval of an expression multiple times.

    I do not know how Morpheus specifically handles this, but I'd be very surprised if it was different. My statement should not be taken as authoritative but it is likely to be true Someday when I find some 'roundtuits', or someone else familiar with it, will look.

    Last edited by Todesengel; November 16th, 2019 at 12:40 PM. Reason: 4:20

  3. #13


    Appreciate your input

    Maybe I can do some test case comparisons for speed.

    I tend to use multiple comparatives or ranges within my IF statements which tend to not translate well into a switch. But hey, where there is a will there is a way!

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts