Dynaplex: analyzing program complexity using dynamically inferred recurrence relations
Didier Ishimwe, KimHao Nguyen, ThanhVu Nguyen
Abstract
Being able to detect program runtime complexity is useful in many tasks (e.g., checking expected performance and identifying potential security vulnerabilities). In this work, we introduce a new dynamic approach for inferring the asymptotic complexity bounds of recursive programs. From program execution traces, we learn recurrence relations and solve them using pattern matching to obtain closed-form solutions representing the complexity bounds of the program. This approach allows us to efficiently infer simple recurrence relations that represent nontrivial, potentially nonlinear polynomial and non-polynomial, complexity bounds. We present Dynaplex, a tool that implements these ideas to automatically generate recurrence relations from execution traces. Our preliminary results on popular and challenging recursive programs show that Dynaplex can learn precise relations capturing worst-case complexity bounds (e.g., O ( n log n ) for mergesort, O (2 n ) for Tower of Hanoi and O ( n 1.58 ) for Karatsuba’s multiplication algorithm).
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 28110607-eeac-40ee-ac7e-0f31121e9edfCited by top-tier papers2
- Robust Resource Bounds with Static Analysis and Bayesian InferenceLong Pham, Feras A. Saad, Jan HoffmannPLDI 2024 · 6 citations
- Integrating Resource Analyses via Resource DecompositionLong Pham, Yue Niu, Nathaniel Glover, Feras Saad et al.OOPSLA 2025
Builds on4
- SlowFuzz: Automated Domain-Independent Detection of Algorithmic Complexity VulnerabilitiesTheofilos Petsios, Jason Zhao, Angelos D. Keromytis, Suman JanaCCS 2017 · 214 citations
- Templates and recurrences: better togetherJason Breck, John Cyphert, Zachary Kincaid, Thomas W. RepsPLDI 2020 · 30 citations
- DynamiTe: dynamic termination and non-termination proofsTon Chanh Le, Timos Antonopoulos, Parisa Fathololumi, Eric Koskinen et al.OOPSLA 2020 · 26 citations
- Learning nonlinear loop invariants with gated continuous logic networksJianan Yao, Gabriel Ryan, Justin Wong, Suman Jana et al.PLDI 2020 · 1 citation
Related papers
- Synthesis with Asymptotic Resource BoundsQinheping Hu, John Cyphert, Loris D'Antoni, Thomas W. RepsCAV 2021 · 5 citations
- Recurrence extraction for functional programs through call-by-push-valueG. A. Kavvos, Edward Morehouse, Daniel R. Licata, Norman DannerPOPL 2020 · 20 citations
- Adaptive Recursive Query OptimizationAnna Herlihy, Guillaume Martres, Anastasia Ailamaki, Martin OderskyICDE 2024 · 5 citations
- Automated Tail Bound Analysis for Probabilistic Recurrence RelationsYican Sun, Hongfei Fu, Krishnendu Chatterjee, Amir Kafshdar GoharshadyCAV 2023 · 9 citations
- Mobius: Synthesizing Relational Queries with Recursive and Invented PredicatesAalok Thakkar, Nathaniel Sands, George Petrou, Rajeev Alur et al.OOPSLA 2023 · 5 citations
