简体   繁体   中英

Benchmarking two RxJava observables (Android)?

I have two rx.Observable s that do the same thing (load data from disk), but in two different ways.

Observable<Data> getDataFromDb();
Observable<Data> getDataFromJson();

I want to benchmark the performance of each, so I know which one to use. What is the best approach to do this for Android?

Not an official benchmark, but RxJava has the timeInterval operator which measures the milliseconds between the arrival of subsequent values via a Scheduler's now() call (which is essentially System.currentTimeMillis() for most Schedulers). The first value will have the time difference between when the subscription happened and when the first value has been emitted.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM