RxJava Code Review Part 1
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
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
Lines of code by package
Code coverage
Tools I've used:
- IntelliJ IDEA 14.
- Metrics Reloaded plugin for IntelliJ IDEA.
- CyVis Software Complexity Visualizer.
- Jacoco Gradle Plugin Gradle plugin for code coverage.
Related issues and PRs:
- PR #3089: Add code quality plugins to build.gradle.
- Issue #3100: Enforce min code coverage level in the project.
- PR #3112: Observers package test coverage and fixes.
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.