Código: |
|
DIAB-04-03-1 | Publicación: |
|
25-03-2004 | Título: |
|
Combining Composition and Tupling for Optimizing Declarative Programs | Detalle: |
|
This paper investigates the optimization by fold/unfold of
declarative programs that integrate the best features from both functional and logic programming. Transformation sequences are guided by a mixed strategy that successfully combines two well-known heuristics -composition and tupling- thus avoiding the construction of intermediate data structures and redundant sub-computations. We have decomposed the internal structure of both methods in three low-level transformation phases in order to analyze their main similarities and differences. In particular, whereas composition is able to produce a single function definition for some nested (composed) functions, the tupling method needs more sophisticated analysis for discovering the set
of calls to be tupled. We solve this problem by simply considering non-nested calls sharing common variables on a given expression. With this easy method, that complements the one done by composition, we are able to perform powerful tupling optimizations at a very low cost. Moreover, by appropriately combining both strategies, we optimize a wide range of programs containing nested
and/or non-nested function calls in a fully automatic way. | |
|
|
|