-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
perf(compiler-cli): skip analysis in incremental builds for files wit… #42562
Conversation
944eb8a
to
397d115
Compare
397d115
to
3fb8f04
Compare
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 seems like a good optimisation. Thanks @JoostK.
One thing that slightly worries me is the use of null
and undefined
to have context specific meanings.
I think we should discuss the idea, going forward, of using well defined singleton branded objects that are then self-documenting, rather than relying upon documented specialized use of null
.
For example in this case instead of null
we could have: const NO_ANGULAR_TRAITS = { _brand: 'source file with no Angular traits' };
.
The Though there is precedent for using the angular/packages/compiler-cli/src/ngtsc/shims/src/adapter.ts Lines 137 to 144 in a92a89b
|
Merge assistance: NgBot doesn't change the status to fully "green" due to one more reviewer assigned, but since Pete reviewed the change it might be ok to proceed without extra reviews? // cc @alxhub |
*/ | ||
priorAnalysisFor(sf: ts.SourceFile): AnalysisT[]|null; | ||
priorAnalysisFor(sf: ts.SourceFile): AnalysisT[]|null|undefined; |
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 there much of a difference between using null
here to indicate "analyzed, but had no traits" and using an empty array instead? I really try to avoid using null
and undefined
in the same type to indicate two different states.
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 considered that but found the null|undefined
more explicit; the handling code in TraitCompiler.analyze
is now forced to special-case putting null
into this.filesWithoutTraits
, whereas an empty array would not have required a change based on the type-system (and missed the necessity to update this.filesWithoutTraits
)
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 don't feel particularly strongly about this, though, so happy to switch to []
if you think that's desirable.
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.
Ok, updated. That actually allowed most of the earlier changes to be reverted.
…hout Angular behavior In an incremental rebuild, the compiler attempts to reuse as much analysis data from a prior compilation as possible to avoid doing the analysis work again. For source files without Angular behavior however, no analysis data would be recorded such that the source file had to be reanalyzed each rebuild, even if it has not changed. This commit avoids the analysis of such source files by registering these files as not containing any Angular behavior; allowing subsequent rebuilds to avoid the analysis work.
…les without Angular behavior
3fb8f04
to
a0cb10f
Compare
merge-assistance: presubmit succeeded on an earlier revision; this should be fine to merge. |
…hout Angular behavior (#42562) In an incremental rebuild, the compiler attempts to reuse as much analysis data from a prior compilation as possible to avoid doing the analysis work again. For source files without Angular behavior however, no analysis data would be recorded such that the source file had to be reanalyzed each rebuild, even if it has not changed. This commit avoids the analysis of such source files by registering these files as not containing any Angular behavior; allowing subsequent rebuilds to avoid the analysis work. PR Close #42562
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…hout Angular behavior
In an incremental rebuild, the compiler attempts to reuse as much
analysis data from a prior compilation as possible to avoid doing the
analysis work again. For source files without Angular behavior however,
no analysis data would be recorded such that the source file had to be
reanalyzed each rebuild, even if it has not changed.
This commit avoids the analysis of such source files by registering
these files as not containing any Angular behavior; allowing subsequent
rebuilds to avoid the analysis work.