Skip to content

Handlebars: optimize render state #1097

@alandefreitas

Description

@alandefreitas

RenderState keeps a vector of every ancestor level. Helpers only need to walk up the stack when .. appears, so the vector incurs unnecessary allocations.

Proposed solution

  • Store only the current level plus a pointer to the parent state.
  • Follow parent pointers when .. is used repeatedly.
  • Remove vector allocations and simplify debug output.

Requirements

  • Engine keeps only the current state and a parent pointer.
  • Helpers behave the same.
  • Benchmarks show reduced allocations.
  • Documentation/comments explain the new layout.

Note
Once the standalone Handlebars repository exists, move this issue there and track it in the new project.

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