-
Notifications
You must be signed in to change notification settings - Fork 659
Make SourceFileAffectingCompilerOptions hold fully computed values, use in binder #788
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
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.
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
AllowUnusedLabels: options.AllowUnusedLabels, | ||
PreserveConstEnums: options.PreserveConstEnums, | ||
IsolatedModules: options.IsolatedModules, | ||
func (options *CompilerOptions) SourceFileAffecting() *SourceFileAffectingCompilerOptions { |
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.
This is not cached anywhere since we'd have to put it on CompilerOptions, which means sync.Once
, which means no more DeepEqual
.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
AllowUnusedLabels: options.AllowUnusedLabels, | ||
PreserveConstEnums: options.PreserveConstEnums, | ||
IsolatedModules: options.IsolatedModules, | ||
func (options *CompilerOptions) SourceFileAffecting() *SourceFileAffectingCompilerOptions { |
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'm not sure if this should continue to be a value type or not, since we pass it around and so on. But it's not that large, actually.
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 tested and it keeping it a value doesn't actually hurt or help perf, so I could do that.
@@ -1331,7 +1331,7 @@ func (b *Binder) checkStrictModeWithStatement(node *ast.Node) { | |||
|
|||
func (b *Binder) checkStrictModeLabeledStatement(node *ast.Node) { | |||
// Grammar checking for labeledStatement | |||
if b.inStrictMode && b.options.Target >= core.ScriptTargetES2015 { | |||
if b.inStrictMode && b.options.EmitScriptTarget >= core.ScriptTargetES2015 { |
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.
This is a porting bug I'm fixing, FWIW.
…se in binder (microsoft#788) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR makes
SourceFileAffectingCompilerOptions
consist of only fully computed values (in prep for some other changes).SourceFileAffectingCompilerOptions
is smaller, allowing much more AST reuse.The AST reuse results in the tests running 20-25% faster, and using 1GB less peak memory.
psrecord before:
psrecord after:
Before, it's maybe 8GB, before maybe 7GB.