File tree 1 file changed +14
-1
lines changed
rxjava-core/src/main/java/rx/internal/operators
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,20 @@ private void handleNewSource(Observable<? extends T> t) {
136
136
}
137
137
MergeProducer <T > producerIfNeeded = null ;
138
138
// if we have received a request then we need to respect it, otherwise we fast-path
139
- if (mergeProducer .requested >= 0 ) {
139
+ if (mergeProducer .requested != Long .MAX_VALUE ) {
140
+ /**
141
+ * <pre> {@code
142
+ * With this optimization:
143
+ *
144
+ * r.o.OperatorMergePerf.merge1SyncStreamOfN 1000 thrpt 5 57100.080 4686.331 ops/s
145
+ * r.o.OperatorMergePerf.merge1SyncStreamOfN 1000000 thrpt 5 60.875 1.622 ops/s
146
+ *
147
+ * Without this optimization:
148
+ *
149
+ * r.o.OperatorMergePerf.merge1SyncStreamOfN 1000 thrpt 5 29863.945 1858.002 ops/s
150
+ * r.o.OperatorMergePerf.merge1SyncStreamOfN 1000000 thrpt 5 30.516 1.087 ops/s
151
+ * } </pre>
152
+ */
140
153
producerIfNeeded = mergeProducer ;
141
154
}
142
155
InnerSubscriber <T > i = new InnerSubscriber <T >(this , producerIfNeeded );
You can’t perform that action at this time.
0 commit comments