[英]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.我有两个
rx.Observable
做同样的事情(从磁盘加载数据),但有两种不同的方式。
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?
为 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).不是官方基准,但 RxJava 有
timeInterval
运算符,它通过调度程序的 now() 调用(对于大多数调度程序来说本质上是 System.currentTimeMillis())测量后续值到达之间的毫秒数。 The first value will have the time difference between when the subscription happened and when the first value has been emitted.第一个值将具有订阅发生时间和第一个值发出时间之间的时间差。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.