[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Discussion of computed GO and CASE



Three remarks:

(1) It isn't necessarily true that an indexed jump is a faster
implementation of CASE than a series of conditional branches.  It
depends on the number of clauses in the CASE statement, on the
particular machine architecture, and in many architectures on the
particular machine model.  The minimum number of clauses for which an
indexed jump is preferable generally increases with the performance of
the machine, as more pipelining and branch prediction hardware is used.

(2) We would surely rather have our compilers optimize this than do it
ourselves, by writing different source code for different machines.

(3) If our compilers don't produce code that is as efficient as we would
like, we should change our compilers, not our language.  The language
should only be changed when there is a widely-agreed-upon reason why the
language makes efficient compilation impossible; that is clearly not the
case here.