Skip to content
This repository was archived by the owner on Apr 20, 2018. It is now read-only.

Commit 1c3a4b1

Browse files
even moar perf
1 parent a0772f7 commit 1c3a4b1

38 files changed

+589
-197
lines changed

dist/rx.aggregates.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,21 @@
212212
return new ReduceObservable(this, accumulator, hasSeed, seed);
213213
};
214214

215+
var SomeObservable = (function (__super__) {
216+
inherits(SomeObservable, __super__);
217+
function SomeObservable(source, fn) {
218+
this.source = source;
219+
this._fn = fn;
220+
__super__.call(this);
221+
}
222+
223+
SomeObservable.prototype.subscribeCore = function (o) {
224+
return this.source.subscribe(new SomeObserver(o, this._fn, this.source));
225+
};
226+
227+
return SomeObservable;
228+
}(ObservableBase));
229+
215230
var SomeObserver = (function (__super__) {
216231
inherits(SomeObserver, __super__);
217232

@@ -246,12 +261,24 @@
246261
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
247262
*/
248263
observableProto.some = function (predicate, thisArg) {
249-
var source = this, fn = bindCallback(predicate, thisArg, 3);
250-
return new AnonymousObservable(function (o) {
251-
return source.subscribe(new SomeObserver(o, fn, source));
252-
});
264+
var fn = bindCallback(predicate, thisArg, 3);
265+
return new SomeObservable(this, fn);
253266
};
254267

268+
var IsEmptyObservable = (function (__super__) {
269+
inherits(IsEmptyObservable, __super__);
270+
function IsEmptyObservable(source) {
271+
this.source = source;
272+
__super__.call(this);
273+
}
274+
275+
IsEmptyObservable.prototype.subscribeCore = function (o) {
276+
return this.source.subscribe(new IsEmptyObserver(o));
277+
};
278+
279+
return IsEmptyObservable;
280+
}(ObservableBase));
281+
255282
var IsEmptyObserver = (function(__super__) {
256283
inherits(IsEmptyObserver, __super__);
257284
function IsEmptyObserver(o) {
@@ -277,10 +304,7 @@
277304
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
278305
*/
279306
observableProto.isEmpty = function () {
280-
var source = this;
281-
return new AnonymousObservable(function (o) {
282-
return source.subscribe(new IsEmptyObserver(o));
283-
}, source);
307+
return new IsEmptyObservable(this);
284308
};
285309

286310
var EveryObserver = (function (__super__) {

dist/rx.aggregates.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.aggregates.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.compat.js

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,6 +2548,21 @@ var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
25482548
return new OfEnumerable(source, selector, thisArg);
25492549
};
25502550

2551+
var ObserveOnObservable = (function (__super__) {
2552+
inherits(ObserveOnObservable, __super__);
2553+
function ObserveOnObservable(source, s) {
2554+
this.source = source;
2555+
this._s = s;
2556+
__super__.call(this);
2557+
}
2558+
2559+
ObserveOnObservable.prototype.subscribeCore = function (o) {
2560+
return this.source.subscribe(new ObserveOnObserver(this._s, o));
2561+
};
2562+
2563+
return ObserveOnObservable;
2564+
}(ObservableBase));
2565+
25512566
/**
25522567
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
25532568
*
@@ -2558,12 +2573,32 @@ var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
25582573
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
25592574
*/
25602575
observableProto.observeOn = function (scheduler) {
2561-
var source = this;
2562-
return new AnonymousObservable(function (observer) {
2563-
return source.subscribe(new ObserveOnObserver(scheduler, observer));
2564-
}, source);
2576+
return new ObserveOnObservable(this, scheduler);
25652577
};
25662578

2579+
var SubscribeOnObservable = (function (__super__) {
2580+
inherits(SubscribeOnObservable, __super__);
2581+
function SubscribeOnObservable(source, s) {
2582+
this.source = source;
2583+
this._s = s;
2584+
__super__.call(this);
2585+
}
2586+
2587+
function scheduleMethod(scheduler, state) {
2588+
var source = state[0], d = state[1], o = state[2];
2589+
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(o)));
2590+
}
2591+
2592+
SubscribeOnObservable.prototype.subscribeCore = function (o) {
2593+
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
2594+
d.setDisposable(m);
2595+
m.setDisposable(this._s.schedule([this.source, d, o], scheduleMethod));
2596+
return d;
2597+
};
2598+
2599+
return SubscribeOnObservable;
2600+
}(ObservableBase));
2601+
25672602
/**
25682603
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
25692604
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
@@ -2575,15 +2610,7 @@ var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
25752610
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
25762611
*/
25772612
observableProto.subscribeOn = function (scheduler) {
2578-
var source = this;
2579-
return new AnonymousObservable(function (observer) {
2580-
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
2581-
d.setDisposable(m);
2582-
m.setDisposable(scheduler.schedule(source, function (scheduler, source) {
2583-
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
2584-
}));
2585-
return d;
2586-
}, source);
2613+
return new SubscribeOnObservable(this, scheduler);
25872614
};
25882615

25892616
var FromPromiseObservable = (function(__super__) {
@@ -5908,6 +5935,21 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
59085935
return new ReduceObservable(this, accumulator, hasSeed, seed);
59095936
};
59105937

5938+
var SomeObservable = (function (__super__) {
5939+
inherits(SomeObservable, __super__);
5940+
function SomeObservable(source, fn) {
5941+
this.source = source;
5942+
this._fn = fn;
5943+
__super__.call(this);
5944+
}
5945+
5946+
SomeObservable.prototype.subscribeCore = function (o) {
5947+
return this.source.subscribe(new SomeObserver(o, this._fn, this.source));
5948+
};
5949+
5950+
return SomeObservable;
5951+
}(ObservableBase));
5952+
59115953
var SomeObserver = (function (__super__) {
59125954
inherits(SomeObserver, __super__);
59135955

@@ -5942,12 +5984,24 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
59425984
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
59435985
*/
59445986
observableProto.some = function (predicate, thisArg) {
5945-
var source = this, fn = bindCallback(predicate, thisArg, 3);
5946-
return new AnonymousObservable(function (o) {
5947-
return source.subscribe(new SomeObserver(o, fn, source));
5948-
});
5987+
var fn = bindCallback(predicate, thisArg, 3);
5988+
return new SomeObservable(this, fn);
59495989
};
59505990

5991+
var IsEmptyObservable = (function (__super__) {
5992+
inherits(IsEmptyObservable, __super__);
5993+
function IsEmptyObservable(source) {
5994+
this.source = source;
5995+
__super__.call(this);
5996+
}
5997+
5998+
IsEmptyObservable.prototype.subscribeCore = function (o) {
5999+
return this.source.subscribe(new IsEmptyObserver(o));
6000+
};
6001+
6002+
return IsEmptyObservable;
6003+
}(ObservableBase));
6004+
59516005
var IsEmptyObserver = (function(__super__) {
59526006
inherits(IsEmptyObserver, __super__);
59536007
function IsEmptyObserver(o) {
@@ -5973,10 +6027,7 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
59736027
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
59746028
*/
59756029
observableProto.isEmpty = function () {
5976-
var source = this;
5977-
return new AnonymousObservable(function (o) {
5978-
return source.subscribe(new IsEmptyObserver(o));
5979-
}, source);
6030+
return new IsEmptyObservable(this);
59806031
};
59816032

59826033
var EveryObserver = (function (__super__) {

dist/rx.all.compat.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.compat.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.js

Lines changed: 72 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,6 +2321,21 @@ var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
23212321
return new OfEnumerable(source, selector, thisArg);
23222322
};
23232323

2324+
var ObserveOnObservable = (function (__super__) {
2325+
inherits(ObserveOnObservable, __super__);
2326+
function ObserveOnObservable(source, s) {
2327+
this.source = source;
2328+
this._s = s;
2329+
__super__.call(this);
2330+
}
2331+
2332+
ObserveOnObservable.prototype.subscribeCore = function (o) {
2333+
return this.source.subscribe(new ObserveOnObserver(this._s, o));
2334+
};
2335+
2336+
return ObserveOnObservable;
2337+
}(ObservableBase));
2338+
23242339
/**
23252340
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
23262341
*
@@ -2331,12 +2346,32 @@ var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
23312346
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
23322347
*/
23332348
observableProto.observeOn = function (scheduler) {
2334-
var source = this;
2335-
return new AnonymousObservable(function (observer) {
2336-
return source.subscribe(new ObserveOnObserver(scheduler, observer));
2337-
}, source);
2349+
return new ObserveOnObservable(this, scheduler);
23382350
};
23392351

2352+
var SubscribeOnObservable = (function (__super__) {
2353+
inherits(SubscribeOnObservable, __super__);
2354+
function SubscribeOnObservable(source, s) {
2355+
this.source = source;
2356+
this._s = s;
2357+
__super__.call(this);
2358+
}
2359+
2360+
function scheduleMethod(scheduler, state) {
2361+
var source = state[0], d = state[1], o = state[2];
2362+
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(o)));
2363+
}
2364+
2365+
SubscribeOnObservable.prototype.subscribeCore = function (o) {
2366+
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
2367+
d.setDisposable(m);
2368+
m.setDisposable(this._s.schedule([this.source, d, o], scheduleMethod));
2369+
return d;
2370+
};
2371+
2372+
return SubscribeOnObservable;
2373+
}(ObservableBase));
2374+
23402375
/**
23412376
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
23422377
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
@@ -2348,15 +2383,7 @@ var FlatMapObservable = Rx.FlatMapObservable = (function(__super__) {
23482383
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
23492384
*/
23502385
observableProto.subscribeOn = function (scheduler) {
2351-
var source = this;
2352-
return new AnonymousObservable(function (observer) {
2353-
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
2354-
d.setDisposable(m);
2355-
m.setDisposable(scheduler.schedule(source, function (scheduler, source) {
2356-
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
2357-
}));
2358-
return d;
2359-
}, source);
2386+
return new SubscribeOnObservable(this, scheduler);
23602387
};
23612388

23622389
var FromPromiseObservable = (function(__super__) {
@@ -5770,6 +5797,21 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
57705797
return new ReduceObservable(this, accumulator, hasSeed, seed);
57715798
};
57725799

5800+
var SomeObservable = (function (__super__) {
5801+
inherits(SomeObservable, __super__);
5802+
function SomeObservable(source, fn) {
5803+
this.source = source;
5804+
this._fn = fn;
5805+
__super__.call(this);
5806+
}
5807+
5808+
SomeObservable.prototype.subscribeCore = function (o) {
5809+
return this.source.subscribe(new SomeObserver(o, this._fn, this.source));
5810+
};
5811+
5812+
return SomeObservable;
5813+
}(ObservableBase));
5814+
57735815
var SomeObserver = (function (__super__) {
57745816
inherits(SomeObserver, __super__);
57755817

@@ -5804,12 +5846,24 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
58045846
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
58055847
*/
58065848
observableProto.some = function (predicate, thisArg) {
5807-
var source = this, fn = bindCallback(predicate, thisArg, 3);
5808-
return new AnonymousObservable(function (o) {
5809-
return source.subscribe(new SomeObserver(o, fn, source));
5810-
});
5849+
var fn = bindCallback(predicate, thisArg, 3);
5850+
return new SomeObservable(this, fn);
58115851
};
58125852

5853+
var IsEmptyObservable = (function (__super__) {
5854+
inherits(IsEmptyObservable, __super__);
5855+
function IsEmptyObservable(source) {
5856+
this.source = source;
5857+
__super__.call(this);
5858+
}
5859+
5860+
IsEmptyObservable.prototype.subscribeCore = function (o) {
5861+
return this.source.subscribe(new IsEmptyObserver(o));
5862+
};
5863+
5864+
return IsEmptyObservable;
5865+
}(ObservableBase));
5866+
58135867
var IsEmptyObserver = (function(__super__) {
58145868
inherits(IsEmptyObserver, __super__);
58155869
function IsEmptyObserver(o) {
@@ -5835,10 +5889,7 @@ Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisA
58355889
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
58365890
*/
58375891
observableProto.isEmpty = function () {
5838-
var source = this;
5839-
return new AnonymousObservable(function (o) {
5840-
return source.subscribe(new IsEmptyObserver(o));
5841-
}, source);
5892+
return new IsEmptyObservable(this);
58425893
};
58435894

58445895
var EveryObserver = (function (__super__) {

dist/rx.all.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.all.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)