Formally Based Pro ling for Higher-Order Functional Languages
نویسنده
چکیده
We present the rst source-level prooler for a compiled, nonstrict, higher-order, purely functional language capable of measuring time as well as space usage. Our prooler is implemented in a production-quality optimizing compiler for Haskell and can successfully proole large applications. A unique feature of our approach is that we give a formal speciication of the attribution of execution costs to cost centers. This speciication enables us to discuss our design decisions in a precise framework, prove properties about the attribution of costs, and examine the eeects of diierent program transformations on the attribution of costs. Since it is not obvious how to map this speciication onto a particular implementation, we also present an implementation-oriented operational semantics, and prove it equivalent to the speciication. 1. MOTIVATION AND OVERVIEW Everyone knows the importance of prooling tools: the best way to improve a pro-gram's performance is to concentrate on the parts or features of a program that are \eating the lion's share" of the machine resources Bentley 1982; Ingalls 1972; Knuth 1971]. One would expect prooling tools to be particularly useful for very high-level languages where the mapping from source code to target machine is much less obvious to the programmer than it is for (say) C. Despite this obvious need, prooling tools for such languages are very rare. Why? Because proolers can only readily measure or count low-level execution events, whose relationship to the under the title \Time and space prooling for non-strict, higher-order functional languages." original high-level program can be far from obvious. With this in mind, we have developed a prooler for Haskell, a higher-order non-strict, purely functional language Hudak et al. 1992]. We make three main contributions: (1) We describe a source-level prooler for a compiled, nonstrict language capable of measuring both execution time and space usage. Nonstrict languages are usually implemented using some form of lazy evaluation, whereby values are computed only when required. For example, if one function produces a list which is consumed by another, execution alternates between producer and consumer in a coroutine-like fashion. Execution of diierent parts of the program is therefore nely interleaved, which makes it diicult to measure how much time is spent in each \part" of the program. Our prooler solves this problem; indeed, though the results depend on the degree of evaluation, they are entirely independent of the order in which the evaluation proceeds. This issue has been independently addressed …
منابع مشابه
Time and Space Prooling for Non-strict, Higher-order Functional Languages 1 Motivation and Overview
We present the rst prooler for a compiled, non-strict, higher-order, purely functional language capable of measuring time as well as space usage. Our pro-ler is implemented in a production-quality optimising compiler for Haskell, has low overheads, and can successfully proole large applications. A unique feature of our approach is that we give a formal speciication of the attribution of executi...
متن کاملProgram equivalence in linear contexts
Program equivalence in linear contexts, where programs are used or executed exactly once, is an important issue in programming languages. However, existing techniques like those based on bisimulations and logical relations only target at contextual equivalence in the usual (non-linear) functional languages, and fail in capturing non-trivial equivalent programs in linear contexts, particularly w...
متن کاملFormally Correct Translation of Dsp Algorithms Specified in an Asynchronous Applicative Language
The functional pro rammin language ALDiSP, which is special1 tailored to the nee& of DSfprogramming, is presented. ALDiS6 m c o y t e s data streams and an asynchronous control concept base on on1 one construct, the suspension. A comparison with traditional DZP languages like SILAGE is made. It is shown how ALDiSP pro rams can be translated into efficient code using the techniques of abstract i...
متن کاملHigher-order queries and applications
Higher-order transformations are ubiquitous within data management. In relational databases, higher-order queries appear in numerous aspects including query rewriting and query specification. In XML databases, higher-order functions are natural due to the close connection of XML query languages with functional programming. The thesis investigates higher-order query languages that combine higher...
متن کاملOn a functional equation for symmetric linear operators on $C^{*}$ algebras
Let $A$ be a $C^{*}$ algebra, $T: Arightarrow A$ be a linear map which satisfies the functional equation $T(x)T(y)=T^{2}(xy),;;T(x^{*})=T(x)^{*} $. We prove that under each of the following conditions, $T$ must be the trivial map $T(x)=lambda x$ for some $lambda in mathbb{R}$: i) $A$ is a simple $C^{*}$-algebra. ii) $A$ is unital with trivial center and has a faithful trace such ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1997