Lucid and Efficient Case Analysis

Lucid and Efficient Case Analysis Ulfar Erlingsson Mukkai Krishnamoorthy T. V. Raman Algorithms Compilers Switch statements This paper describes a new scheme for building static search trees, using multiway radix search trees. We present this method for code generation of switch statements in imperative languages. We show that, for sparse case sets, the method produces faster code on average than existing methods, requiringO(1) time with a small constant for the average search. We then apply this method to the problem of code generation for generic functions in object-oriented languages, and find that its use improves clarity as well as efficiency. Department of Computer Science, Rensselaer Polytechnic Institute, Troy, NY cs-95-14

Lucid and Efficient Case Analysis

Ulfar Erlingsson

Mukkai Krishnamoorthy

T. V. Raman

Algorithms

Compilers

Switch statements

This paper describes a new scheme for building static search trees, using multiway radix search trees. We present this method for code generation of switch statements in imperative languages. We show that, for sparse case sets, the method produces faster code on average than existing methods, requiringO(1) time with a small constant for the average search. We then apply this method to the problem of code generation for generic functions in object-oriented languages, and find that its use improves clarity as well as efficiency.

Department of Computer Science, Rensselaer Polytechnic Institute, Troy, NY

cs-95-14