Representation Sharing for Prolog
Phuong-Lan Nguyen, Bart Demoen

TL;DR
This paper explores representation sharing in Prolog, introducing practical methods like input sharing and a runtime sharer module, demonstrating their implementation in hProlog and analyzing their performance and application-dependent effectiveness.
Contribution
It presents new techniques for representation sharing in Prolog, including an easy input sharing method and a runtime sharer module adaptable to WAM-like systems.
Findings
The sharer has a cost comparable to heap garbage collection.
Effectiveness of sharing is highly application dependent.
Sharing policy needs tuning for optimal performance.
Abstract
Representation sharing can reduce the memory footprint of a program by sharing one representation between duplicate terms. The most common implementation of representation sharing in functional programming systems is known as hash-consing. In the context of Prolog, representation sharing has been given little attention. Some current techniques that deal with representation sharing are reviewed. The new contributions are: (1) an easy implementation of {\em input sharing} for {\em findall/3}; (2) a description of a {\em sharer} module that introduces representation sharing at runtime. Their realization is shown in the context of the WAM as implemented by hProlog. Both can be adapted to any WAM-like Prolog implementation. The sharer works independently of the garbage collector, but it can be made to cooperate with the garbage collector. Benchmark results show that the sharer has a cost…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Formal Methods in Verification · Logic, Reasoning, and Knowledge
