Lexical Profiling
Manual optimisation of run-time time and memory usage is problematic for lazy Functional Programing (FP) languages. FP programmers do not specify detailed memory allocations, and function evaluation may be interlaced dynamically; the mapping between the source code and what happens at run-time is complex. Is it possible to provide meaningful and intuitive profiling information in such a context? and if so how? This target behaviour was achieved by attributing time and space costs to portions of the source code as though strict evaluation had occurred, whilst reporting the quantitative measures of the actual lazy evaluation. The following paper provided the design and the first implementation of this technique for an interpreted language, together with suggestions of how to implement it for a compiled language. The technique was adopted and further developed by the profiler for the popular GHC functional language compiler.
- Lexical Profiling: Theory and Practice (Clack, Clayman and Parrott, Journal of Functional Programming, 5(2):225-277, Cambridge University Press, ISSN 0956-7968, 1995