Skip to content

Significantly improve performance of BasicFormat #977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Oct 19, 2022

In visit(TokenSyntax), we were modifying the token in place, which caused the entire syntax tree to be rewritten to its root. It’s a lot (6x) faster to just modify leadingTrivia and trailingTrivia and create a new TokenSyntax that doesn’t have a parent.

@ahoppen
Copy link
Member Author

ahoppen commented Oct 19, 2022

@swift-ci Please test

In `visit(TokenSyntax)`, we were modifying the token in place, which caused the entire syntax tree to be rewritten to it’s root. It’s a lot (6x) faster to just modify `leadingTrivia` and `trailingTrivia` and create a new `TokenSyntax` that doesn’t have a parent.
@ahoppen ahoppen force-pushed the ahoppen/basic-format-performance branch from 0cdfd8a to 5692c16 Compare October 19, 2022 07:30
@ahoppen
Copy link
Member Author

ahoppen commented Oct 19, 2022

@swift-ci Please test

1 similar comment
@ahoppen
Copy link
Member Author

ahoppen commented Oct 19, 2022

@swift-ci Please test

@ahoppen ahoppen merged commit a007ed7 into swiftlang:main Oct 19, 2022
@ahoppen ahoppen deleted the ahoppen/basic-format-performance branch October 19, 2022 16:25
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