Saturday, November 21, 2015

On the Road to Rxjava

Okay, a little background the java.util.Observable has a flawed mechanism.   Oh gosh what could it be?

Facebook was talking about recently byte code weaving callbacks. But in that clear-as-mud post they did not state why other than the implied speed boost.

If you look at the code behind the new definition of Observable that Google's data-binding library uses you will find that the callback mechanism was rewired(not rewritten at the framework level but the array/collection of was implemented differently). That is where the speed difference is coming from when you compare speed of the data-binding Observers callbacks to a regular android callbacks as far as having a collection of callbacks that are called in a group.

In short words, even if you do not adopt using Google's data binding library and may not tackle rxJava right now, one should re-use the Observable classes from the databinding library and the rewritten and rewired callback mechanism.

That way one would have some of the benefits without fully tackling Rxjava right now.