Skip to content

architecture: cache template parse result — re-parse only when file changes on disk #368

@KrisSimon

Description

@KrisSimon

Migrated from GitLab issue #160
Originally created: 2026-03-13
Closed: 2026-03-22
Author: Kris Simon

Problem

Every Transform the <x> from the <template: name.screen> call reads and re-parses the template file from disk. In a tight render loop (e.g. TUI refreshing 10×/s) this is wasteful I/O and CPU.

Fix

Cache parsed Template objects keyed by file path. Invalidate the cache entry when the file's mtime changes (stat the file, compare mtime before re-parsing). In production builds, cache unconditionally.

Files

Sources/ARORuntime/Templates/TemplateExecutor.swift

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions