Skip to content

perf: avoid copying resolved values during variable resolution - #706

Open
janmrow wants to merge 1 commit into
theskumar:mainfrom
janmrow:perf/resolve-variables-env-copies
Open

janmrow wants to merge 1 commit into
theskumar:mainfrom
janmrow:perf/resolve-variables-env-copies

Conversation

@janmrow

@janmrow janmrow commented Sep 15, 2026

Copy link
Copy Markdown

resolve_variables() currently rebuilds a merged environment for every variable, including copying all values that have already been resolved.

This change uses ChainMap for the resolved values, while keeping the existing os.environ snapshot behavior and lookup order for override=True and override=False.

In a local resolve-only benchmark with 8,000 bindings, runtime dropped from ~479 ms to ~27 ms.

@janmrow
janmrow force-pushed the perf/resolve-variables-env-copies branch from 99f688f to dfddb1d Compare September 15, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant