Efficient Evaluation for Untyped and Compositional Representations of Expressions
Report, 2014

This report gives a simple implementation of A. Baars and S.D. Swierstra's "Typing Dynamic Typing" using modern (GHC) Haskell features, and shows that the technique is especially beneficial in a compositional setting, where parts of the expression are defined separately. Evaluating expressions that are represented as algebraic data types typically requires using tagged unions to represent values. Tagged unions can introduce runtime overhead due to tag checking, and this overhead is unnecessary if the evaluated expression is well-typed. Likewise, pattern matching on the constructors of the expression causes overhead which is unnecessary if the same expression is evaluated multiple times. Typing Dynamic Typing solves both of these problems by deferring all tag checking to an initial "dynamic compilation" phase after which evaluation proceeds without any tag checking or pattern matching. The problems of tag checking and pattern matching are worse in a compositional setting, and our measurements show that the technique gives especially good performance gains for compositional expressions.

Author

Emil Axelsson

Chalmers, Computer Science and Engineering (Chalmers), Software Technology (Chalmers)

Efficient and Compositional Evaluation of Untyped Expressions

Trends in Functional Programming,; (2014)

Other conference contribution

Areas of Advance

Information and Communication Technology

Subject Categories

Software Engineering

Technical report - Department of Computer Science and Engineering, Chalmers University of Technology and Göteborg University: 1652

More information

Created

10/6/2017