Skip to content
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

Improve SyntaxRewriter performance for operator folding #2036

Open
ahoppen opened this issue Aug 9, 2023 · 1 comment · May be fixed by #2078
Open

Improve SyntaxRewriter performance for operator folding #2036

ahoppen opened this issue Aug 9, 2023 · 1 comment · May be fixed by #2078
Assignees
Labels
enhancement New feature or request

Comments

@ahoppen
Copy link
Collaborator

ahoppen commented Aug 9, 2023

Running operator folding on MovieSwiftUI takes as long as parsing. That really shouldn’t be the case. Running with Instruments shows that we spend the majority of time in memory-related operations.

The first steps to take would be:

  • Add an arena parameter to all the syntax node initializers
  • Add an arena parameter to SyntaxRewriter
  • Construct all nodes in SyntaxRewriter and operator folding in that arena
  • Investigate where else SyntaxRewriter is causing memory allocations and try to eliminate them

Attached is a WIP diff where I started to eliminate some of the memory allocations by SyntaxRewriter but I stopped once I realized that we’d need to modify the initializers of all syntax nodes.

reduce-arena-memory-allocations.txt

@ahoppen ahoppen added the enhancement New feature or request label Aug 9, 2023
@ahoppen
Copy link
Collaborator Author

ahoppen commented Aug 9, 2023

Tracked in Apple’s issue tracker as rdar://113605046

@kimdv kimdv self-assigned this Aug 16, 2023
@kimdv kimdv linked a pull request Aug 16, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants