RxJava Code Review Part 1

RxJava Code Review Part 1
Weary Herakles, Roman marble statue excavated in 1980 in Perge, Turkey.

Disclaimer

RxJava has became a critical component of huge amount of modern apps, we use it for everything: networking and other io, business logic, calculations and so on.

Motivation

Recently, guys from NY Times found a major issue in RxJava that affects performance of applications: NewThreadWorker.tryEnableCancelPolicy doing costly reflection on Android

https://github.com/ReactiveX/RxJava/issues/3119

Goal

So, to keep myself calm and continue using RxJava without worries, I decided to make full code review of RxJava sources, understand it better, create issues and PRs if I find something suspicious and share some results with you to save your time.

Part 1

RxJava v1.0.13, commit a3a0b1ff6a3e3a8ce185cce9c74f8b8f7826f10e code metrics (exluding tests):

  • 811 KB rxjava-1.0.13.jar
  • 755 classes, that's a lot for review…
  • 3263 methods, LGTM, but don't forget about 65K methods limit on Android.
  • 43649 lines of code, I guess, I'll spend couple of weeks on that.
  • 78% code coverage, that's good, but some of the classes have very small coverage (several classes with 0 coverage).
Some diagrams and graphics:

Number of classes by package
Number of classes by package

Lines of code by package
Lines of code by package

Code coverage
Code coverage

Tools I've used:

Related issues and PRs:

Also, one of the main RxJava developers — @akarnokd David Karnok (definitely follow him in Twitter and read his blog about RxJava internals!) showed interest in improving code coverage in the project and his last PRs make situation better, that's great.

This was Part 1.