Skip to content

perf: Use List instead of Array for CtxModuleDef before/after #90

@dowdiness

Description

@dowdiness

Currently CtxModuleDef stores before and after as Array[(VarName, Term)]. Every go_right/go_left step copies the entire array — O(N) per step, O(N²) over a full traversal.

Fix: Replace with reversed/forward @list.List (functional cons-list). Navigation becomes O(1) cons/decons. plug iterates once to reconstruct the array.

When: Profile first. Lambda modules are typically small, so this may not matter in practice.

Files: lang/lambda/zipper/zipper.mbtTermCtx::CtxModuleDef, go_down, go_right, go_left, plug

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions