I ran some tests to see which performs the best. SELECT CASE AS LONG or SELECT CASE AS CONST performs as fast as an Assembler compare list. Plain SELECT was 8 times slower. (taking empty loops into consideration)

The IF THEN result was most interesting as it appears to outperform the assembler test.

It seems that the compiler omits empty IF clauses or those which are never used. Can't tell which.

`#COMPILE EXE`

#DIM ALL

FUNCTION PBMAIN () AS LONG

DIM c AS LONG

DIM i AS LONG

DIM t AS SINGLE

t=TIMER

DO

INCR i:IF i>1e8 THEN EXIT LOOP

c=3

#IF 0

SELECT CASE AS CONST c

CASE 0

CASE 1

CASE 2

CASE 3

CASE 4

CASE 5

CASE 6

CASE 7

CASE 8

CASE 9

END SELECT

#ENDIF

#IF 0

ON c GOTO 0,1,2,3,4,5,6,7,8,9

GOTO nx

0: GOTO nx

1: GOTO nx

2: GOTO nx

3: GOTO nx

4: GOTO nx

5: GOTO nx

6: GOTO nx

7: GOTO nx

8: GOTO nx

9: GOTO nx

nx:

#ENDIF

#IF 0

! mov c,3

a0:

! cmp c,0

! jnz a1

! jmp nx

a1:

! cmp c,1

! jnz a2

! jmp nx

a2:

! cmp c,2

! jnz a3

! jmp nx

a3:

! cmp c,3

! jnz a4

! jmp nx

a4:

! cmp c,4

! jnz a5

! jmp nx

a5:

! cmp c,5

! jnz a6

! jmp nx

a6:

! cmp c,6

! jnz a7

! jmp nx

a7:

! cmp c,7

! jnz a8

! jmp nx

a8:

! cmp c,8

! jnz a9

! jmp nx

a9:

! cmp c,9

! jnz nx

! jmp nx

nx:

#ENDIF

'#if 0

IF c=0 THEN GOTO nx

IF c=1 THEN GOTO nx

IF c=2 THEN GOTO nx

IF c=3 THEN GOTO nx

IF c=4 THEN GOTO nx

IF c=5 THEN GOTO nx

IF c=6 THEN GOTO nx

IF c=7 THEN GOTO nx

IF c=8 THEN GOTO nx

IF c=9 THEN GOTO nx

nx:

'#endif

LOOP

MSGBOX STR$(TIMER-t)

' results in seconds:

' SELECT CASE c: 4.4

' assembler cmp... 1.03

' SELECT CASE AS LONG c 1.06

' SELECT CASE AS CONST c 0.905

' ON C GOTO 01 02 ... 0.87

' IF THEN .. 0.609

' (empty loop) 0.505

'

END FUNCTION