Skip to content
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(Subscription): improve parent management #4526

Merged
merged 1 commit into from
Feb 1, 2019

Commits on Feb 1, 2019

  1. perf(Subscription): improve parent management

    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.
    bmeurer committed Feb 1, 2019
    Configuration menu
    Copy the full SHA
    46d4f3f View commit details
    Browse the repository at this point in the history