-
Notifications
You must be signed in to change notification settings - Fork 441
Eliminate SyntaxArena.default #1050
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
Conversation
@swift-ci Please test |
222f854
to
e19c5f2
Compare
@swift-ci Please test |
Big +1 from me, this is pretty amazing. In terms of memory usage, I'm seeing a 2-3x improvement over In terms of time performance, SwiftLint sees a 19% to 47% (!!) overall processing time speedup, and that's considering other processing time not related to SwiftSyntax. |
91d4b51
to
2881388
Compare
@swift-ci Please test |
1 similar comment
@swift-ci Please test |
@jpsim I updated the PR. I don't think this would change the performance much, but could you test it again, just to make sure? |
@@ -219,7 +219,7 @@ extension RawSyntax { | |||
/// If the syntax tree did not contain a token and thus no trivia could be attached to it, `nil` is returned. | |||
/// - Parameters: | |||
/// - leadingTrivia: The trivia to attach. | |||
func withLeadingTrivia(_ leadingTrivia: Trivia) -> RawSyntax? { | |||
func withLeadingTrivia(_ leadingTrivia: Trivia, arena: SyntaxArena) -> RawSyntax? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this actually needed? We're always using the one arena for RawSyntax
anyway aren't we? You also removed these in your other PR, so there'll be a conflict (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
I see similar performance with 2881388 |
@@ -219,7 +219,7 @@ extension RawSyntax { | |||
/// If the syntax tree did not contain a token and thus no trivia could be attached to it, `nil` is returned. | |||
/// - Parameters: | |||
/// - leadingTrivia: The trivia to attach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if you care about keeping parameter docstrings up to date, but if so this one’s missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for noticing. Updated.
2881388
to
09fe05f
Compare
@swift-ci Please test |
SyntaxArena.default was a global arena which just leaked. Eliminate it, and make all Syntax factory/modifier API use a new arena. rdar://101894396
09fe05f
to
584d1ab
Compare
@swift-ci Please test |
This update pulls in swiftlang/swift-syntax#1050, which fixes a memory leak, reducing memory usage by up to 3x and improves lint times by 20%-50% in my tests.
SyntaxArena.default was a global arena which just leaked. Eliminate it, and make all Syntax factory/modifier API use a new arena.
rdar://101894396