Skip to content

Switch to lazily performing capture transforms - #917

Draft
natecook1000 wants to merge 1 commit into
swiftlang:mainfrom
natecook1000:perf/lazy-capture-transforms
Draft

natecook1000 wants to merge 1 commit into
swiftlang:mainfrom
natecook1000:perf/lazy-capture-transforms

Conversation

@natecook1000

Copy link
Copy Markdown
Member

This changes stored captures to hold only a range plus an index into a per-attempt value table, so that the undo logs have no reference counting. Custom matchers and their transforms, along with TryCapture transforms, still run during matching and cache their result in a register array. All other transforms are performed post-successful match.

Stored captures now hold only a range plus indices into a per-attempt
value table, so the capture undo log has no reference counting. Capture
transforms run once the match is complete; failable (TryCapture)
transforms still run during matching to decide whether to backtrack, and
their result is cached in the table. Custom matcher values live there too.
@natecook1000
natecook1000 marked this pull request as draft November 11, 2026 22:12
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