Constant Term Caching

Stratego -- Strategies for Program Transformation
Terms are constructed dynamically, even when they are are constant at compile time. Constant term caching is a transformation that lifts out constant terms and constructs them once at program initialization time.


  • repeated construction of the same term becomes O(1)


  • constant terms that would never be constructed dynamically are now constructed
  • the order of term construction changes, this may affect strategies such as new
  • constant terms can no longer be garbage collected

Lifting may done by nested function calls during initialization or by storing the constant term in a string (either in textual or BinaryATermFormat?) and reading that in at run-time.

-- EelcoVisser - 09 Dec 2001

Implemented in StrategoRelease07. Performance effects should be evaluated.

-- EelcoVisser - 16 Jan 2002

CategoryDone? | ToDo | StrategoOptimization