17
17
18
18
import java .util .concurrent .TimeUnit ;
19
19
20
- import org .openjdk .jmh .annotations .BenchmarkMode ;
21
- import org .openjdk .jmh .annotations .Benchmark ;
22
- import org .openjdk .jmh .annotations .Mode ;
23
- import org .openjdk .jmh .annotations .OutputTimeUnit ;
24
- import org .openjdk .jmh .annotations .Param ;
25
- import org .openjdk .jmh .annotations .Scope ;
26
- import org .openjdk .jmh .annotations .State ;
20
+ import org .openjdk .jmh .annotations .*;
27
21
import org .openjdk .jmh .infra .Blackhole ;
28
22
29
- import rx .Observable ;
23
+ import rx .* ;
30
24
import rx .Observable .OnSubscribe ;
31
- import rx .Subscriber ;
32
- import rx .jmh .InputWithIncrementingInteger ;
33
- import rx .jmh .LatchedObserver ;
25
+ import rx .functions .Func1 ;
26
+ import rx .jmh .*;
34
27
import rx .schedulers .Schedulers ;
35
28
36
29
@ BenchmarkMode (Mode .Throughput )
@@ -81,7 +74,7 @@ public void call(Subscriber<? super Integer> s) {
81
74
}
82
75
83
76
@ State (Scope .Thread )
84
- public static class InputWithInterval extends InputWithIncrementingInteger {
77
+ public static class InputWithInterval extends InputWithIncrementingInteger implements Func1 < Long , Integer > {
85
78
86
79
@ Param ({ "1" , "1000" })
87
80
public int size ;
@@ -97,7 +90,11 @@ public int getSize() {
97
90
public void setup (Blackhole bh ) {
98
91
super .setup (bh );
99
92
100
- interval = Observable .timer (0 , 1 , TimeUnit .MILLISECONDS ).take (size ).cast (Integer .class );
93
+ interval = Observable .timer (0 , 1 , TimeUnit .MILLISECONDS ).take (size ).map (this );
94
+ }
95
+ @ Override
96
+ public Integer call (Long t1 ) {
97
+ return t1 .intValue ();
101
98
}
102
99
}
103
100
0 commit comments