-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
10e8b78
commit e657d22
Showing
9 changed files
with
88 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
rxjava-core/src/perf/java/rx/operators/OperatorObserveOnPerformance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package rx.operators; | ||
|
||
import rx.Observable; | ||
import rx.perf.AbstractPerformanceTester; | ||
import rx.perf.IntegerSumObserver; | ||
import rx.schedulers.Schedulers; | ||
import rx.util.functions.Action0; | ||
|
||
public class OperatorObserveOnPerformance extends AbstractPerformanceTester { | ||
|
||
private static long reps = 1000000; | ||
|
||
OperatorObserveOnPerformance() { | ||
super(reps); | ||
} | ||
|
||
public static void main(String args[]) { | ||
|
||
final OperatorObserveOnPerformance spt = new OperatorObserveOnPerformance(); | ||
try { | ||
spt.runTest(new Action0() { | ||
|
||
@Override | ||
public void call() { | ||
spt.timeObserveOn(); | ||
} | ||
}); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Observable.from(1L).observeOn() | ||
* | ||
*/ | ||
public long timeObserveOn() { | ||
|
||
Observable<Integer> s = Observable.range(1, (int) reps).observeOn(Schedulers.newThread()); | ||
IntegerSumObserver o = new IntegerSumObserver(); | ||
s.subscribe(o); | ||
return o.sum; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters