Skip to content

Instantly share code, notes, and snippets.

@artem-zinnatullin
Last active August 29, 2015 14:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artem-zinnatullin/51b6c6720ecb8a2a71eb to your computer and use it in GitHub Desktop.
Save artem-zinnatullin/51b6c6720ecb8a2a71eb to your computer and use it in GitHub Desktop.
Fix for performance issue in RxJava 1.0.3+
// Issue: https://github.com/ReactiveX/RxJava/issues/3119
class YourApp extends Application {
static {
// I recommend you to put this code into static initialization block of Application class
// because Application class will be loaded before you will start doing some work via RxJava
// PLEASE add comment "remove fix from app class… when you'll switch to new version of RxJava"
// near to "compile 'io.reactivex:rxjava:1.0.13'" in your build.gradle
System.setProperty("rx.scheduler.jdk6.purge-force", "true");
// Please read changelogs of new RxJava releases and remove this workaround when problem will be fixed
// I hope fix https://github.com/ReactiveX/RxJava/pull/3121 will be merged into RxJava 1.0.14
// Notice, this issue also affects non-Android systems: backends, etc,
// because RxJava 1.0.13 does not cache reflection call. You can apply this to your backend apps too.
}
}
// PR with fix: https://github.com/ReactiveX/RxJava/pull/3121
// Feel free to contact me: https://twitter.com/artem_zin
@artem-zinnatullin
Copy link
Author

Please don't use it anymore, RxJava 1.0.14 has fix for this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment