1717
1818import java .util .concurrent .TimeUnit ;
1919
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 .*;
2721import org .openjdk .jmh .infra .Blackhole ;
2822
29- import rx .Observable ;
23+ import rx .* ;
3024import 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 .*;
3427import rx .schedulers .Schedulers ;
3528
3629@ BenchmarkMode (Mode .Throughput )
@@ -81,7 +74,7 @@ public void call(Subscriber<? super Integer> s) {
8174 }
8275
8376 @ State (Scope .Thread )
84- public static class InputWithInterval extends InputWithIncrementingInteger {
77+ public static class InputWithInterval extends InputWithIncrementingInteger implements Func1 < Long , Integer > {
8578
8679 @ Param ({ "1" , "1000" })
8780 public int size ;
@@ -97,7 +90,11 @@ public int getSize() {
9790 public void setup (Blackhole bh ) {
9891 super .setup (bh );
9992
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 ();
10198 }
10299 }
103100
0 commit comments