• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ReactiveX / rxjs / 7965
97%
master: 97%

Build:
Build:
LAST BUILD BRANCH: patch-1
DEFAULT BRANCH: master
Ran 28 Jan 2019 03:28PM UTC
Jobs 1
Files 190
Run time 15s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
7965

Pull #4499

travis-ci

web-flow
perf(Subscription): use `instanceof` to avoid megamorphic LoadIC

In `Subscription#add()` use `instanceof` to test whether `subscription`
must be wrapped in a `Subscription` (aka for presence of `_addParent`
method), instead of `typeof subscription._addParent === 'function'`,
as the latter is going to turn into a *megamorphic property access*
in any realistic application and cause quite a bit of contention on
the megamorphic stub cache in Node (aka V8).

The `instanceof` is definitely faster, even if the property access
would hit the megamorphic stub cache. For example in the case of a
simple [Angular Universal prerender][1] test, just changing this can
reduce the number of megamorphic stub cache misses by around **2%**.

Even in the case where the megamorphic stub cache hits all the time,
using `instanceof` is still faster. I put together a little micro-
benchmark [here][2]. Running this with the latest V8 we get:

```
$ out/Release/d8 bench-instanceof-versus-typeof-megamorphic.js
instanceOf: 91 ms.
typeOf: 138 ms.
```

[1]: https://gist.githubusercontent.com/bmeurer/5b9480ef1a74c5187180193abc73dcd4/raw/fc5d9a01a/prerender.js
[2]: https://gist.github.com/bmeurer/d6d8d4e5d3a9937499ed738c93b3b7cf
Pull Request #4499: perf(Subscription): use `instanceof` to avoid megamorphic LoadIC

1736 of 2091 branches covered (83.02%)

1 of 1 new or added line in 1 file covered. (100.0%)

5256 of 5429 relevant lines covered (96.81%)

1144.89 hits per line

Jobs
ID Job ID Ran Files Coverage
1 7965.1 (NODE_VER=8 FULL_VALIDATE=true) 28 Jan 2019 03:28PM UTC 0
96.81
Travis Job 7965.1
Source Files on build 7965
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #7965
  • Pull Request #4499
  • PR Base - master (#7960)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc