This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf($q): small $q performance optimization
Only generate a new promise when `then` receives some non-undefined parameter Closes #12535
- Loading branch information
Showing
2 changed files
with
5 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6838c97
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.
No tests?
6838c97
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.
@lgalfaso, won't this have the (breaking) side-effect of not invoking
scheduleProcessQueue(this.$$state)
under certain circumstances ?6838c97
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.
@gkalpak there is no side-effect. This is the reasoning:
this.$$state.pending
isnull
or[]
then nothing is added, so no side-effect.this.$$state.pending
has elements andthis.$$state.status <= 0
thenscheduleProcessQueue
would not get called, so no side-effects.this.$$state.pending
has elements andthis.$$state.status > 0
and the elements where added after the change of status, then there is already a call toscheduleProcessQueue
pending on the previousthen
call, so no side-effects.this.$$state.pending
has elements andthis.$$state.status > 0
and the elements where not added after the change of status, then the change of status would callscheduleProcessQueue
to schedule resolving the pending promises, so no side-effects.The only side-effect is when running tests and hopefully that is properly reflected with #12705