Profiling tools, which measure and display the dynamic space and time behaviour of programs, are essential for identifying execution bottlenecks. A variety of such tools exist for conventional languages, but almost none for non-strict functional languages. There is a good reason for this: lazy evaluation means that the program is executed in an order which is not immediately apparent from the source code, so it is difficult to relate dynamically-gathered statistics back to the original source. We present a new technique which solves this problem. The framework is general enough to profile both space and time behaviour. Better still, it is cheap to implement, and we describe how to do so in the context of the Spineless Tagless G-machine. 1 Introduction Many functional programs are quick and concise to express (Hughes ) but often slow to run. Before being able to improve the efficiency of a program, a programmer has to be able to: 1. Identify the execution bottlenecks or "critical...
user correction - Legacy Corrections
In Fifth Annual Glasgow Workshop on Functional Programming