Skip to content

Remove unneccessary clone of Ast - #1419

Merged
sgrif merged 4 commits into
mainfrom
jk-sg-remove-clone
Aug 24, 2026
Merged

Remove unneccessary clone of Ast#1419
sgrif merged 4 commits into
mainfrom
jk-sg-remove-clone

Conversation

@jkaczman

Copy link
Copy Markdown
Contributor

When constructing a RouterContext, the code always cloned the AST if it was present, assuming cloning is cheap. It isn't. There is potentially a String and Vec on the Ast which are getting deep copied, every time.

RouterContext never needs ownership of the Ast, and already takes a lifetime, so removing the clone is relatively trivial

Co-Authored-By: Sage <sagetheprogrammer.com>

When constructing a RouterContext, the code always cloned the AST if it was
present, assuming cloning is cheap. It isn't. There is potentially a String and
Vec on the Ast which are getting deep copied, every time.

RouterContext never needs ownership of the Ast, and already takes a lifetime, so
removing the clone is relatively trivial
@jkaczman
jkaczman requested review from levkk and sgrif August 24, 2026 17:44
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sgrif
sgrif merged commit b566e4c into main Aug 24, 2026
29 checks passed
@sgrif
sgrif deleted the jk-sg-remove-clone branch August 24, 2026 18:00
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.

2 participants