-
Notifications
You must be signed in to change notification settings - Fork 552
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
Pool some more nodes in test profile #360
base: main
Are you sure you want to change the base?
Conversation
This reverts commit f62b247.
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.
PR Overview
This PR aims to improve performance by pooling additional AST node types to reduce object allocations. Key changes include:
- Adding new pools for InterfaceDeclaration, KeywordExpression, MethodSignatureDeclaration, NumericLiteral, and UnionTypeNode.
- Updating the corresponding New* functions to use the new pools.
- Modifying node creation in the AST to leverage pooled instances for improved memory reuse.
Reviewed Changes
File | Description |
---|---|
internal/ast/ast.go | Introduces new node pools and updates node creation functions to use pooling |
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
internal/ast/ast.go:5357
- Verify that the UnionTypeNode object returned from the pool is properly cleared of any prior state. Explicitly resetting fields might be necessary to guarantee correct behavior.
data := f.unionTypeNodePool.New()
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
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.
14% less allocations, looks like it worth it.
Profiling #275 netted some simple wins; a few new AST nodes to pool.