Re: switch vs if

From: Mark A. Heilpern (heilpern@MINDSPRING.COM)
Date: 05/03/98

At 03:37 PM 5/3/98 -0400, you wrote:
>WHich is quicker
>if (this == that || this == that2)
>switch (this) {
>  case that:
>  case that2:

Questions like that are compiler-dependent, and often
dependent on what opimization switches are enabled.
The best way to get your answer is to compile as
simplified a case as you can to assembly and look at
the resulting code (assuming your compiler does not
optimize once assembly is created). Or, you could
always disassemble from within gdb to see the final

Sorry I can't give you the simple "A is faster than B"

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST