-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(Subscription): improve parent management (#4526)
Merge the `_parent` and `_parents` fields on the `Subscription` class into a single `_parentOrParents` field, which can hold either `null` (in case of no parents), a `Subscription` instance (in case of a single parent), or an array of `Subscription`s (in case of multiple parents). This not only shrinks the size of `Subscription` (and subclass) instances, but more importantly reduces the number of megamorphic property access sites in the hot `Subscription` methods, especially in `unsubscribe()` and `add()`. Also inline the `Subscription#_addParent()` method into `Subscription#add()`, as it's the only call site anyways and this removes another hot megamorphic `LoadIC` that was only needed to lookup `subscription._addParent` in the call site. Finally remove the `hasErrors` variable from `unsubscribe()` method and instead just check `errors` variable directly.
- Loading branch information
Showing
2 changed files
with
43 additions
and
58 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