Cost Analysis Using Automatic Size and Time Inference

  • Álvaro J. Rebón Portillo
  • Kevin Hammond
  • Hans-Wolfgang Loidl
  • Pedro Vasconcelos
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2670)


Cost information can be exploited in a variety of contexts, including parallelizing compilers, autonomic GRIDs and real-time systems. In this paper, we introduce a novel type and effect system — the sized time system that is capable of determining upper bounds for both time and space costs, and which we initially intend to apply to determining good granularity for parallel tasks. The analysis is defined for a simple, strict, higher-order and polymorphic functional language, \( \mathcal{L} \) , incorporating arbitrarily-sized list data structures. The inference algorithm implementing this analysis constructs cost- and size-terms for \( \mathcal{L} \)-expressions, plus constraints over free size and cost variables in those terms that can be solved to produce information for higher-order functions. The paper presents both the analysis and the inference algorithm, providing examples that illustrate the primary features of the analysis.


Cost Information Inference Algorithm Size Information Functional Language Latent Cost 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Hammond, K., Michaelson, G.: Parallel Functional Programming. Springer (2000)Google Scholar
  2. 2.
    Nielson, F., Nielson, H.R., Hankin, C.: Principles of Program Analysis. Springer (1999)Google Scholar
  3. 3.
    Mitchell, J.C.: Subtyping and Related Concepts. In: Foundations for Programming Languages. MIT Press (1996)Google Scholar
  4. 4.
    Hughes, R., Pareto, L., Sabry, A.: Proving the Correctness of Reactive Systems using Sized Types. In: POPL’96, St Petersburg, FL (1996)Google Scholar
  5. 5.
    Reistad, B., Gifford, D.: Static Dependent Costs for Estimating Execution Time. In: LFP’94, Orlando, FL (1994) 65–78Google Scholar
  6. 6.
    Frühwirth, T.: Theory and practice of constraint handling rules. Journal of Logic Programming 37 (1998)Google Scholar
  7. 7.
    Smolka, G.: The Oz Programming Model. In: Computer Science Today. LNCS 1000. Springer (1995) 324–343CrossRefGoogle Scholar
  8. 8.
    Jones, S.P., Hughes, J., Augustsson, L., Barton, D., Boutel, B., Burton, W., Fasel, J., Hammond, K., Hinze, R., Hudak, P., Johnsson, T., Jones, M., Launchbury, J., Meijer, E., Peterson, J., Reid, A., Runciman, C., Wadler, P.: Haskell 98: A Non-Strict, Purely Functional Language. (1999)Google Scholar
  9. 9.
    Loidl, H.W., Hammond, K.: A Sized Time System for a Parallel Functional Language. In: Glasgow Workshop on Functional Programming, Ullapool (1996)Google Scholar
  10. 10.
    Loidl, H.W.: Granularity in Large-Scale Parallel Functional Programming. PhD thesis, Department of Computing Science, University of Glasgow (1998)Google Scholar
  11. 11.
    Dornic, V., Jouvelot, P., Gifford, D.: Polymorphic Time Systems for Estimating Program Complexity. ACM Letters on Prog. Lang. and Systems 1 (1992) 33–45CrossRefGoogle Scholar
  12. 12.
    Grobauer, B.: Cost Recurrences for DML Programs. In: ICFP’01, Florence, Italy, ACM Press (2001)Google Scholar
  13. 13.
    Chin, W.N., Khoo, S.C.: Calculating sized types. Higher-Order and Symbolic Computing 14 (2001)Google Scholar
  14. 14.
    Le Métayer, D.: ACE: An Automatic Complexity Evaluator. TOPLAS 10 (1988)Google Scholar
  15. 15.
    Rosendahl, M.: Automatic Complexity Analysis. In: FPCA’89. (1989) 144–156Google Scholar
  16. 16.
    Flajolet, P., Salvy, B., Zimmermann, P.: Automatic Average-Case Analysis of Algorithms. Theoretical Computer Science 79 (1991) 37–109zbMATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    Huelsbergen, L., Larus, J., Aiken, A.: Using Run-Time List Sizes to Guide Parallel Thread Creation. In: LFP’94, Orlando, FL (1994) 79–90Google Scholar
  18. 18.
    Debray, S., Lin, N.W., Hermenegildo, M.: Task Granularity Analysis in Logic Programs. In: PLDI’90. SIGPLAN Notices 25(6), ACM Press (1990) 174–188CrossRefGoogle Scholar
  19. 19.
    Tick, E., Zhong, X.: A Compile-Time Granularity Analysis Algorithm and its Performance Evaluation. New Generation Computing 11 (1993) 271–295CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Álvaro J. Rebón Portillo
    • 1
  • Kevin Hammond
    • 1
  • Hans-Wolfgang Loidl
    • 2
  • Pedro Vasconcelos
    • 1
  1. 1.School of Computer ScienceUniversity of St AndrewsSt AndrewsUK
  2. 2.Institut für InformatikLudwig-Maximilians-Universität MünchenMunchenGermany

Personalised recommendations