We present the rst system for estimating and using datadependent expression execution times in a language with rst-class procedures and imperative constructs. The presence of rst-class procedures and imperative constructs makes cost estimation a global problem that can bene t from type information. We estimate expression costs with the aid of an algebraic type reconstruction system that assigns every procedure a type that includes a static dependent cost. A static dependent cost describes the execution time of a procedure in terms of its inputs. In particular, a procedure's static dependent cost can depend on the size of input data structures and the cost of input rst-class procedures. Our cost system produces symbolic cost expressions that contain free variables describing the size and cost of the procedure's inputs. At run-time, a cost estimate is dynamically computed from the statically determined cost expression and run-time cost and size information. We present experime...
Brian Reistad, David K. Gifford