Precise Cost Analysis via Local Reasoning

  • Diego Esteban Alonso-Blas
  • Puri Arenas
  • Samir Genaim
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8172)


The classical approach to static cost analysis is based on first transforming a given program into a set of cost relations, and then solving them into closed-form upper-bounds. The quality of the upper-bounds and the scalability of such cost analysis highly depend on the precision and efficiency of the solving phase. Several techniques for solving cost relations exist, some are efficient but not precise enough, and some are very precise but do not scale to large cost relations. In this paper we explore the gap between these techniques, seeking for ones that are both precise and efficient. In particular, we propose a novel technique that first splits the cost relation into several atomic ones, and then uses precise local reasoning for some and less precise but efficient reasoning for others. For the precise local reasoning, we propose several methods that define the cost as a solution of a universally quantified formula. Preliminary experiments demonstrate the effectiveness of our approach.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
    Albert, E., Alonso, D., Arenas, P., Genaim, S., Puebla, G.: Asymptotic Resource Usage Bounds. In: Hu, Z. (ed.) APLAS 2009. LNCS, vol. 5904, pp. 294–310. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  3. 3.
    Albert, E., Arenas, P., Genaim, S., Puebla, G.: Closed-Form Upper Bounds in Static Cost Analysis. J. Autom. Reasoning 46(2), 161–203 (2011)MathSciNetCrossRefGoogle Scholar
  4. 4.
    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)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Albert, E., Genaim, S., Masud, A.N.: On the Inference of Resource Usage Upper and Lower Bounds. ACM Trans. Comput. Log. (to appear, 2013)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Alonso-Blas, D.E., Genaim, S.: On the Limits of the Classical Approach to Cost Analysis. In: Miné, A., Schmidt, D. (eds.) SAS 2012. LNCS, vol. 7460, pp. 405–421. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  7. 7.
    Anderson, H., Khoo, S.-C., Andrei, Ş., Luca, B.: Calculating Polynomial Runtime Properties. In: Yi, K. (ed.) APLAS 2005. LNCS, vol. 3780, pp. 230–246. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  8. 8.
    Bagnara, R., Mesnard, F., Pescetti, A., Zaffanella, E.: A new look at the automatic synthesis of linear ranking functions. Inf. Comput. 215, 47–67 (2012)MathSciNetCrossRefGoogle Scholar
  9. 9.
    Benzinger, R.: Automated higher-order complexity analysis. Theor. Comput. Sci. 318(1-2), 79–103 (2004)MathSciNetCrossRefGoogle Scholar
  10. 10.
    Danner, N., Paykin, J., Royer, J.S.: A Static Cost Analysis for a Higher-Order Language. In: PLPV, pp. 25–34. ACM (2013)Google Scholar
  11. 11.
    Debray, S.K., Lin, N.: Cost Analysis of Logic Programs. ACM Trans. Program. Lang. Syst. 15(5), 826–875 (1993)CrossRefGoogle Scholar
  12. 12.
    Grobauer, B.: Cost Recurrences for DML Programs. In: ICFP, pp. 253–264. ACM (2001)CrossRefGoogle Scholar
  13. 13.
    Gulwani, S., Mehra, J.K., Chilimbi, T.M.: SPEED: Precise and Efficient Static Estimation of Program Computational Complexity. In: POPL, pp. 127–139. ACM (2009)Google Scholar
  14. 14.
    Gulwani, S., Zuleger, F.: The Reachability-Bound Problem. In: PLDI, pp. 292–304. ACM (2010)CrossRefGoogle Scholar
  15. 15.
    Hoffmann, J., Aehlig, a.K., Hofmannn, M.: Multivariate Amortized Resource Analysis. ACM Trans. Program. Lang. Syst. 34(3), 14:1–14:62 (2012)CrossRefGoogle Scholar
  16. 16.
    Simões, H.R., Vasconcelos, P.B., Florido, M., Jost, S., Hammond, K.: Automatic Amortised Analysis of Dynamic Memory Allocation for Lazy Functional Programs. In: ICFP, pp. 165–176. ACM (2012)Google Scholar
  17. 17.
    Vasconcelos, P.B., Hammond, K.: Inferring Cost Equations for Recursive, Polymorphic and Higher-Order Functional Programs. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 86–101. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  18. 18.
    Wegbreit, B.: Mechanical Program Analysis. Commun. ACM 18(9), 528–539 (1975)MathSciNetCrossRefGoogle Scholar
  19. 19.
    Zuleger, F., Gulwani, S., Sinn, M., Veith, H.: Bound Analysis of Imperative Programs with the Size-Change Abstraction. In: Yahav, E. (ed.) SAS 2011. LNCS, vol. 6887, pp. 280–297. Springer, Heidelberg (2011)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2013

Authors and Affiliations

  • Diego Esteban Alonso-Blas
    • 1
  • Puri Arenas
    • 1
  • Samir Genaim
    • 1
  1. 1.DSICComplutense University of Madrid (UCM)Spain

Personalised recommendations