🤖 AI Summary
Lazy evaluation faces an inherent trade-off between sharing overhead (to avoid recomputation) and copying overhead (to enable efficient memory access), limiting asymptotic efficiency.
Method: We propose and systematically study *skeletal call-by-need*, a novel lazy evaluation strategy that decouples data structures into freely copyable “skeletons” (containing shape and pointers) and shared “flesh” (containing values). Integrating Shivers–Wand’s skeleton reconstruction with Accattoli et al.’s λ-calculus distillation, we design the first abstract machine achieving bilinear time and space complexity.
Contribution/Results: We provide the first rigorous formal analysis of skeletal evaluation, proving exponential improvements in both time and space complexity over standard call-by-need. Our work establishes tight acceleration lower bounds and demonstrates empirically superior performance. Beyond theoretical gains, skeletal call-by-need introduces a new lazy evaluation paradigm that is both conceptually simple and practically implementable—resolving the sharing–copying dilemma without sacrificing asymptotic efficiency or engineering feasibility.
📝 Abstract
Skeletal call-by-need is an optimization of call-by-need evaluation also known as"fully lazy sharing": when the duplication of a value has to take place, it is first split into"skeleton", which is then duplicated, and"flesh"which is instead kept shared. Here, we provide two cost analyses of skeletal call-by-need. Firstly, we provide a family of terms showing that skeletal call-by-need can be asymptotically exponentially faster than call-by-need in both time and space; it is the first such evidence, to our knowledge. Secondly, we prove that skeletal call-by-need can be implemented efficiently, that is, with bi-linear overhead. This result is obtained by providing a new smooth presentation of ideas by Shivers and Wand for the reconstruction of skeletons, which is then smoothly plugged into the study of an abstract machine following the distillation technique by Accattoli et al.