[Paper Review] Global Trie for Subterms
This paper proposes Global Trie for Subterms (GT-ST), an extension to the Global Trie (GT) table space organization in Prolog tabling systems, which uniquely represents compound subterms across terms to reduce memory redundancy. Experiments with YapTab show GT-ST achieves significant memory reductions—up to 51% less memory usage for high-arity compound subterms—without degrading execution time, especially for programs with repeated subterms in arguments.
A critical component in the implementation of an efficient tabling system is the design of the table space. The most popular and successful data structure for representing tables is based on a two-level trie data structure, where one trie level stores the tabled subgoal calls and the other stores the computed answers. The Global Trie (GT) is an alternative table space organization designed with the intent to reduce the tables's memory usage, namely by storing terms in a global trie, thus preventing repeated representations of the same term in different trie data structures. In this paper, we propose an extension to the GT organization, named Global Trie for Subterms (GT-ST), where compound subterms in term arguments are represented as unique entries in the GT. Experiments results using the YapTab tabling system show that GT-ST support has potential to achieve significant reductions on memory usage, for programs with increasing compound subterms in term arguments, without compromising the execution time for other programs.
Motivation & Objective
- To reduce memory bloat in Prolog tabling systems caused by repeated representation of identical compound subterms across term arguments.
- To extend the Global Trie (GT) design to optimize memory usage by sharing subterms at the subterm level, not just at the term level.
- To evaluate whether subterm-level sharing in GT-ST improves memory efficiency without compromising execution performance.
- To assess the trade-off between memory savings and overhead in subterm indexing for different program structures.
Proposed method
- Extend the Global Trie (GT) data structure to index and uniquely represent compound subterms (e.g., g/1, g/3, g/5) as shared entries in a global subterm trie.
- Modify the YapTab tabling system to integrate GT-ST, enabling subterm-level canonicalization during table insertion and lookup.
- Use a two-level trie architecture: one for subgoal calls and one for answers, with subterms stored in a global subterm trie to eliminate redundancy.
- Implement a canonical representation mechanism that assigns unique identifiers to structurally identical compound subterms across all tabled terms.
- Support both compiled and non-compiled tries to evaluate performance trade-offs in subterm indexing and lookup.
- Measure memory usage and execution time across multiple test programs with varying subterm complexity and arity.
Experimental results
Research questions
- RQ1Can subterm-level sharing in the Global Trie reduce memory usage in Prolog tabling systems compared to term-level sharing?
- RQ2What is the performance overhead of indexing and resolving compound subterms in GT-ST compared to GT-T?
- RQ3How does the memory and time cost of GT-ST vary with increasing subterm arity and repetition in term arguments?
- RQ4Does GT-ST maintain or improve execution time for programs with minimal subterm redundancy?
- RQ5To what extent does GT-ST outperform GT-T in memory efficiency for programs with high subterm repetition?
Key findings
- For f/3 terms with 500,000 g/5 subterms, GT-ST reduced total memory usage by 49% compared to GT-T (139.24 MB vs. 280.00 MB).
- In the f/3 case with g/5 subterms, GT-ST reduced GT-only memory usage by 53% (129.7 MB vs. 275.5 MB).
- For f/2 terms with g/5 subterms, GT-ST achieved a 36% reduction in total memory usage (93.46 MB vs. 146.00 MB).
- Execution time for storing tables was higher in GT-ST for low-arity subterms (e.g., f/1 with g/1), due to indexing overhead, but this cost was offset by memory savings in high-redundancy cases.
- For programs with high subterm redundancy (e.g., g/5), GT-ST reduced memory usage by up to 51% while maintaining or improving execution time for loading and compiling tries.
- The performance benefit of GT-ST became increasingly evident as subterm arity increased, due to better amortization of indexing costs across more nodes.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.