Skip to main content

Type-Based Amortized Resource Analysis with Integers and Arrays

  • Conference paper
Functional and Logic Programming (FLOPS 2014)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 8475))

Included in the following conference series:

Abstract

Proving bounds on the resource consumption of a program by statically analyzing its source code is an important and well-studied problem. Automatic approaches for numeric programs with side effects usually apply abstract interpretation–based invariant generation to derive bounds on loops and recursion depths of function calls.

This paper presents an alternative approach to resource-bound analysis for numeric, heap-manipulating programs that uses type-based amortized resource analysis. As a first step towards the analysis of imperative code, the technique is developed for a first-order ML-like language with unsigned integers and arrays. The analysis automatically derives bounds that are multivariate polynomials in the numbers and the lengths of the arrays in the input. Experiments with example programs demonstrate two main advantages of amortized analysis over current abstract interpretation–based techniques. For one thing, amortized analysis can handle programs with non-linear intermediate values like f((n + m)2). For another thing, amortized analysis is compositional and works naturally for compound programs like f(g(x)).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Gulwani, S., Mehra, K.K., Chilimbi, T.M.: SPEED: Precise and Efficient Static Estimation of Program Computational Complexity. In: 36th ACM Symp. on Principles of Prog. Langs (POPL 2009), pp. 127–139 (2009)

    Google Scholar 

  2. Zuleger, F., Gulwani, S., Sinn, M., Veith, H.: Bound Analysis of Imperative Programs with the Size-Change Abstraction. In: Yahav, E. (ed.) Static Analysis. LNCS, vol. 6887, pp. 280–297. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  3. Albert, E., Arenas, P., Genaim, S., Puebla, G., Zanardini, D.: Cost Analysis of Object-Oriented Bytecode Programs. Theor. Comput. Sci. 413(1), 142–159 (2012)

    Article  MATH  MathSciNet  Google Scholar 

  4. Albert, E., Arenas, P., Genaim, S., Gómez-Zamalloa, M., Puebla, G.: Automatic Inference of Resource Consumption Bounds. In: Bjørner, N., Voronkov, A. (eds.) LPAR-18 2012. LNCS, vol. 7180, pp. 1–11. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  5. Cousot, P., Halbwachs, N.: Automatic Discovery of Linear Restraints Among Variables of a Program. In: 5th ACM Symp. on Principles Prog. Langs (POPL 1978), pp. 84–96 (1978)

    Google Scholar 

  6. Gulavani, B.S., Gulwani, S.: A Numerical Abstract Domain Based on Expression Abstraction and Max Operator with Application in Timing Analysis. In: Gupta, A., Malik, S. (eds.) CAV 2008. LNCS, vol. 5123, pp. 370–384. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  7. Sankaranarayanan, S., Ivančić, F., Shlyakhter, I., Gupta, A.: Static Analysis in Disjunctive Numerical Domains. In: Yi, K. (ed.) SAS 2006. LNCS, vol. 4134, pp. 3–17. Springer, Heidelberg (2006)

    Chapter  Google Scholar 

  8. Alonso-Blas, D.E., Arenas, P., Genaim, S.: Handling Non-linear Operations in the Value Analysis of COSTA. Electr. Notes Theor. Comput. Sci. 279(1), 3–17 (2011)

    Article  Google Scholar 

  9. Hofmann, M., Jost, S.: Static Prediction of Heap Space Usage for First-Order Functional Programs. In: 30th ACM Symp. on Principles of Prog. Langs (POPL 2003), pp. 185–197 (2003)

    Google Scholar 

  10. Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate Amortized Resource Analysis. In: 38th ACM Symp. on Principles of Prog. Langs (POPL 2011) (2011)

    Google Scholar 

  11. Hoffmann, J., Hofmann, M.: Amortized Resource Analysis with Polynomial Potential. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 287–306. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

  12. Aehlig, K., Hofmann, M., Hoffmann, J.: RAML Web Site (2010-2013), http://raml.tcs.ifi.lmu.de

  13. Hoffmann, J., Aehlig, K., Hofmann, M.: Multivariate Amortized Resource Analysis. ACM Trans. Program. Lang. Syst. (2012)

    Google Scholar 

  14. Hoffmann, J., Aehlig, K., Hofmann, M.: Resource Aware ML. In: Madhusudan, P., Seshia, S.A. (eds.) CAV 2012. LNCS, vol. 7358, pp. 781–786. Springer, Heidelberg (2012)

    Chapter  Google Scholar 

  15. Hoffmann, J., Shao, Z.: Type-Based Amortized Resource Analysis with Integers and Arrays (2013) (full version), http://cs.yale.edu/homes/hoffmann/papers/aa_imp2013TR.pdf

  16. Riordan, J., Stein, P.R.: Arrangements on Chessboards. Journal of Combinatorial Theory, Series A 12(1) (1972)

    Google Scholar 

  17. Hoffmann, J., Hofmann, M.: Amortized Resource Analysis with Polymorphic Recursion and Partial Big-Step Operational Semantics. In: Ueda, K. (ed.) APLAS 2010. LNCS, vol. 6461, pp. 172–187. Springer, Heidelberg (2010)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2014 Springer International Publishing Switzerland

About this paper

Cite this paper

Hoffmann, J., Shao, Z. (2014). Type-Based Amortized Resource Analysis with Integers and Arrays. In: Codish, M., Sumii, E. (eds) Functional and Logic Programming. FLOPS 2014. Lecture Notes in Computer Science, vol 8475. Springer, Cham. https://doi.org/10.1007/978-3-319-07151-0_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-07151-0_10

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-07150-3

  • Online ISBN: 978-3-319-07151-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics