Runtime Repeated Recursion Unfolding: A Just-In-Time Online Program Optimization That Can Achieve Super-Linear Speedup

07/05/2023
by   Thom Fruehwirth, et al.
0

We introduce a just-in-time runtime program transformation based on repeated recursion unfolding. Our online polyvariant program specialization generates several versions of a recursion differentiated by the minimal number of recursive steps covered. The base case of the recursion is ignored in our technique. Our method is presented here on the basis of linear direct recursive rules. When a recursive call is encountered at runtime, first an unfolder creates specializations of the associated recursive rule on-the-fly and then an interpreter applies these rules to the call. Our approach reduces the number of recursive rule applications to its logarithm at the expense of introducing a logarithmic number of unfolded rules. Each rule is applied at most once. We prove correctness of our technique and determine its worst-case time complexity. For recursions that solve tractable problems and which have enough unfoldings that can sufficiently simplified, we prove a super-linear speedup theorem, i.e. speedup by more than a constant factor. The simplification is problem-specific and has to be provided at compile-time. In the best case, the complexity of the given recursion is reduced to that of its first recursive step. We have implemented the necessary unfolder and meta-interpreter for runtime repeated recursion unfolding in Constraint Handling Rules (CHR) with just five rules. We illustrate the feasibility of our approach with complexity results and benchmarks for several classical algorithms. The runtime improvement quickly reaches several orders of magnitude.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/11/2020

Repeated Recursion Unfolding for Super-Linear Speedup within Bounds

Repeated recursion unfolding is a new approach that repeatedly unfolds a...
research
02/21/2022

Optimizing Recursive Queries with Program Synthesis

Most work on query optimization has concentrated on loop-free queries. H...
research
02/12/2016

Bouncing Towers move faster than Hanoi Towers, but still require exponential time

The problem of the Hanoi Tower is a classic exercise in recursive progra...
research
08/22/2023

ReLiCADA – Reservoir Computing using Linear Cellular Automata Design Algorithm

In this paper, we present a novel algorithm to optimize the design of Re...
research
06/24/2017

Justifications in Constraint Handling Rules for Logical Retraction in Dynamic Algorithms

We present a straightforward source-to-source transformation that introd...
research
11/06/2018

Unboxing Mutually Recursive Type Definitions in OCaml

In modern OCaml, single-argument datatype declarations (variants with a ...
research
10/15/2018

Optimizing Heuristics for Tableau-based OWL Reasoners

Optimization techniques play a significant role in improving description...

Please sign up or login with your details

Forgot password? Click here to reset