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

Commit d36c511

Browse files
perf cleanup
1 parent f889c4d commit d36c511

28 files changed

Lines changed: 579 additions & 639 deletions

dist/rx.all.compat.js

Lines changed: 60 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2522,42 +2522,42 @@
25222522
__super__.call(this);
25232523
}
25242524

2525-
ToArrayObservable.prototype.subscribeCore = function(observer) {
2526-
return this.source.subscribe(new ToArrayObserver(observer));
2525+
ToArrayObservable.prototype.subscribeCore = function(o) {
2526+
return this.source.subscribe(new InnerObserver(o));
25272527
};
25282528

2529-
return ToArrayObservable;
2530-
}(ObservableBase));
2531-
2532-
function ToArrayObserver(observer) {
2533-
this.observer = observer;
2534-
this.a = [];
2535-
this.isStopped = false;
2536-
}
2537-
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
2538-
ToArrayObserver.prototype.onError = function (e) {
2539-
if (!this.isStopped) {
2540-
this.isStopped = true;
2541-
this.observer.onError(e);
2542-
}
2543-
};
2544-
ToArrayObserver.prototype.onCompleted = function () {
2545-
if (!this.isStopped) {
2546-
this.isStopped = true;
2547-
this.observer.onNext(this.a);
2548-
this.observer.onCompleted();
2549-
}
2550-
};
2551-
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
2552-
ToArrayObserver.prototype.fail = function (e) {
2553-
if (!this.isStopped) {
2554-
this.isStopped = true;
2555-
this.observer.onError(e);
2556-
return true;
2529+
function InnerObserver(o) {
2530+
this.o = o;
2531+
this.a = [];
2532+
this.isStopped = false;
25572533
}
2534+
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
2535+
InnerObserver.prototype.onError = function (e) {
2536+
if (!this.isStopped) {
2537+
this.isStopped = true;
2538+
this.o.onError(e);
2539+
}
2540+
};
2541+
InnerObserver.prototype.onCompleted = function () {
2542+
if (!this.isStopped) {
2543+
this.isStopped = true;
2544+
this.o.onNext(this.a);
2545+
this.o.onCompleted();
2546+
}
2547+
};
2548+
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
2549+
InnerObserver.prototype.fail = function (e) {
2550+
if (!this.isStopped) {
2551+
this.isStopped = true;
2552+
this.o.onError(e);
2553+
return true;
2554+
}
2555+
2556+
return false;
2557+
};
25582558

2559-
return false;
2560-
};
2559+
return ToArrayObservable;
2560+
}(ObservableBase));
25612561

25622562
/**
25632563
* Creates an array from an observable sequence.
@@ -3140,23 +3140,23 @@
31403140
__super__.call(this);
31413141
}
31423142

3143-
ThrowObservable.prototype.subscribeCore = function (observer) {
3144-
var sink = new ThrowSink(observer, this);
3143+
ThrowObservable.prototype.subscribeCore = function (o) {
3144+
var sink = new ThrowSink(o, this);
31453145
return sink.run();
31463146
};
31473147

3148-
function ThrowSink(observer, parent) {
3149-
this.observer = observer;
3150-
this.parent = parent;
3148+
function ThrowSink(o, p) {
3149+
this.o = o;
3150+
this.p = p;
31513151
}
31523152

31533153
function scheduleItem(s, state) {
3154-
var error = state[0], observer = state[1];
3155-
observer.onError(error);
3154+
var e = state[0], o = state[1];
3155+
o.onError(e);
31563156
}
31573157

31583158
ThrowSink.prototype.run = function () {
3159-
return this.parent.scheduler.scheduleWithState([this.parent.error, this.observer], scheduleItem);
3159+
return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem);
31603160
};
31613161

31623162
return ThrowObservable;
@@ -4217,48 +4217,48 @@
42174217
inherits(TapObservable,__super__);
42184218
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
42194219
this.source = source;
4220-
this.tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
4220+
this.t = !observerOrOnNext || isFunction(observerOrOnNext) ?
42214221
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
4222-
observerOrOnNext;;
4222+
observerOrOnNext;
42234223
__super__.call(this);
42244224
}
42254225

4226-
TapObservable.prototype.subscribeCore = function(observer) {
4227-
return this.source.subscribe(new InnerObserver(observer, this.tapObserver));
4226+
TapObservable.prototype.subscribeCore = function(o) {
4227+
return this.source.subscribe(new InnerObserver(o, this.t));
42284228
};
4229-
4230-
function InnerObserver(observer, tapObserver) {
4231-
this.observer = observer;
4232-
this.tapObserver = tapObserver;
4229+
4230+
function InnerObserver(o, t) {
4231+
this.o = o;
4232+
this.t = t;
42334233
this.isStopped = false;
42344234
}
42354235
InnerObserver.prototype.onNext = function(x) {
42364236
if (this.isStopped) { return; }
4237-
var res = tryCatch(this.tapObserver.onNext).call(this.tapObserver, x);
4238-
if (res === errorObj) { this.observer.onError(res.e); }
4239-
this.observer.onNext(x);
4237+
var res = tryCatch(this.t.onNext).call(this.t, x);
4238+
if (res === errorObj) { this.o.onError(res.e); }
4239+
this.o.onNext(x);
42404240
};
42414241
InnerObserver.prototype.onError = function(err) {
42424242
if (!this.isStopped) {
42434243
this.isStopped = true;
4244-
var res = tryCatch(this.tapObserver.onError).call(this.tapObserver, err);
4245-
if (res === errorObj) { return this.observer.onError(res.e); }
4246-
this.observer.onError(err);
4244+
var res = tryCatch(this.t.onError).call(this.t, err);
4245+
if (res === errorObj) { return this.o.onError(res.e); }
4246+
this.o.onError(err);
42474247
}
42484248
};
42494249
InnerObserver.prototype.onCompleted = function() {
42504250
if (!this.isStopped) {
42514251
this.isStopped = true;
4252-
var res = tryCatch(this.tapObserver.onCompleted).call(this.tapObserver);
4253-
if (res === errorObj) { return this.observer.onError(res.e); }
4254-
this.observer.onCompleted();
4252+
var res = tryCatch(this.t.onCompleted).call(this.t);
4253+
if (res === errorObj) { return this.o.onError(res.e); }
4254+
this.o.onCompleted();
42554255
}
42564256
};
42574257
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
42584258
InnerObserver.prototype.fail = function (e) {
42594259
if (!this.isStopped) {
42604260
this.isStopped = true;
4261-
this.observer.onError(e);
4261+
this.o.onError(e);
42624262
return true;
42634263
}
42644264
return false;
@@ -4270,22 +4270,15 @@
42704270
/**
42714271
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
42724272
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
4273-
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
4273+
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.
42744274
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
42754275
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
42764276
* @returns {Observable} The source sequence with the side-effecting behavior applied.
42774277
*/
4278-
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
4279-
4278+
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
42804279
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
42814280
};
42824281

4283-
/** @deprecated use #do or #tap instead. */
4284-
observableProto.doAction = function () {
4285-
//deprecate('doAction', 'do or tap');
4286-
return this.tap.apply(this, arguments);
4287-
};
4288-
42894282
/**
42904283
* Invokes an action for each element in the observable sequence.
42914284
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.

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: 6 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: 60 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,42 +2331,42 @@
23312331
__super__.call(this);
23322332
}
23332333

2334-
ToArrayObservable.prototype.subscribeCore = function(observer) {
2335-
return this.source.subscribe(new ToArrayObserver(observer));
2334+
ToArrayObservable.prototype.subscribeCore = function(o) {
2335+
return this.source.subscribe(new InnerObserver(o));
23362336
};
23372337

2338-
return ToArrayObservable;
2339-
}(ObservableBase));
2340-
2341-
function ToArrayObserver(observer) {
2342-
this.observer = observer;
2343-
this.a = [];
2344-
this.isStopped = false;
2345-
}
2346-
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
2347-
ToArrayObserver.prototype.onError = function (e) {
2348-
if (!this.isStopped) {
2349-
this.isStopped = true;
2350-
this.observer.onError(e);
2351-
}
2352-
};
2353-
ToArrayObserver.prototype.onCompleted = function () {
2354-
if (!this.isStopped) {
2355-
this.isStopped = true;
2356-
this.observer.onNext(this.a);
2357-
this.observer.onCompleted();
2358-
}
2359-
};
2360-
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
2361-
ToArrayObserver.prototype.fail = function (e) {
2362-
if (!this.isStopped) {
2363-
this.isStopped = true;
2364-
this.observer.onError(e);
2365-
return true;
2338+
function InnerObserver(o) {
2339+
this.o = o;
2340+
this.a = [];
2341+
this.isStopped = false;
23662342
}
2343+
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
2344+
InnerObserver.prototype.onError = function (e) {
2345+
if (!this.isStopped) {
2346+
this.isStopped = true;
2347+
this.o.onError(e);
2348+
}
2349+
};
2350+
InnerObserver.prototype.onCompleted = function () {
2351+
if (!this.isStopped) {
2352+
this.isStopped = true;
2353+
this.o.onNext(this.a);
2354+
this.o.onCompleted();
2355+
}
2356+
};
2357+
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
2358+
InnerObserver.prototype.fail = function (e) {
2359+
if (!this.isStopped) {
2360+
this.isStopped = true;
2361+
this.o.onError(e);
2362+
return true;
2363+
}
2364+
2365+
return false;
2366+
};
23672367

2368-
return false;
2369-
};
2368+
return ToArrayObservable;
2369+
}(ObservableBase));
23702370

23712371
/**
23722372
* Creates an array from an observable sequence.
@@ -2995,23 +2995,23 @@
29952995
__super__.call(this);
29962996
}
29972997

2998-
ThrowObservable.prototype.subscribeCore = function (observer) {
2999-
var sink = new ThrowSink(observer, this);
2998+
ThrowObservable.prototype.subscribeCore = function (o) {
2999+
var sink = new ThrowSink(o, this);
30003000
return sink.run();
30013001
};
30023002

3003-
function ThrowSink(observer, parent) {
3004-
this.observer = observer;
3005-
this.parent = parent;
3003+
function ThrowSink(o, p) {
3004+
this.o = o;
3005+
this.p = p;
30063006
}
30073007

30083008
function scheduleItem(s, state) {
3009-
var error = state[0], observer = state[1];
3010-
observer.onError(error);
3009+
var e = state[0], o = state[1];
3010+
o.onError(e);
30113011
}
30123012

30133013
ThrowSink.prototype.run = function () {
3014-
return this.parent.scheduler.scheduleWithState([this.parent.error, this.observer], scheduleItem);
3014+
return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem);
30153015
};
30163016

30173017
return ThrowObservable;
@@ -4072,48 +4072,48 @@
40724072
inherits(TapObservable,__super__);
40734073
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
40744074
this.source = source;
4075-
this.tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
4075+
this.t = !observerOrOnNext || isFunction(observerOrOnNext) ?
40764076
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
4077-
observerOrOnNext;;
4077+
observerOrOnNext;
40784078
__super__.call(this);
40794079
}
40804080

4081-
TapObservable.prototype.subscribeCore = function(observer) {
4082-
return this.source.subscribe(new InnerObserver(observer, this.tapObserver));
4081+
TapObservable.prototype.subscribeCore = function(o) {
4082+
return this.source.subscribe(new InnerObserver(o, this.t));
40834083
};
4084-
4085-
function InnerObserver(observer, tapObserver) {
4086-
this.observer = observer;
4087-
this.tapObserver = tapObserver;
4084+
4085+
function InnerObserver(o, t) {
4086+
this.o = o;
4087+
this.t = t;
40884088
this.isStopped = false;
40894089
}
40904090
InnerObserver.prototype.onNext = function(x) {
40914091
if (this.isStopped) { return; }
4092-
var res = tryCatch(this.tapObserver.onNext).call(this.tapObserver, x);
4093-
if (res === errorObj) { this.observer.onError(res.e); }
4094-
this.observer.onNext(x);
4092+
var res = tryCatch(this.t.onNext).call(this.t, x);
4093+
if (res === errorObj) { this.o.onError(res.e); }
4094+
this.o.onNext(x);
40954095
};
40964096
InnerObserver.prototype.onError = function(err) {
40974097
if (!this.isStopped) {
40984098
this.isStopped = true;
4099-
var res = tryCatch(this.tapObserver.onError).call(this.tapObserver, err);
4100-
if (res === errorObj) { return this.observer.onError(res.e); }
4101-
this.observer.onError(err);
4099+
var res = tryCatch(this.t.onError).call(this.t, err);
4100+
if (res === errorObj) { return this.o.onError(res.e); }
4101+
this.o.onError(err);
41024102
}
41034103
};
41044104
InnerObserver.prototype.onCompleted = function() {
41054105
if (!this.isStopped) {
41064106
this.isStopped = true;
4107-
var res = tryCatch(this.tapObserver.onCompleted).call(this.tapObserver);
4108-
if (res === errorObj) { return this.observer.onError(res.e); }
4109-
this.observer.onCompleted();
4107+
var res = tryCatch(this.t.onCompleted).call(this.t);
4108+
if (res === errorObj) { return this.o.onError(res.e); }
4109+
this.o.onCompleted();
41104110
}
41114111
};
41124112
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
41134113
InnerObserver.prototype.fail = function (e) {
41144114
if (!this.isStopped) {
41154115
this.isStopped = true;
4116-
this.observer.onError(e);
4116+
this.o.onError(e);
41174117
return true;
41184118
}
41194119
return false;
@@ -4125,22 +4125,15 @@
41254125
/**
41264126
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
41274127
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
4128-
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
4128+
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.
41294129
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
41304130
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
41314131
* @returns {Observable} The source sequence with the side-effecting behavior applied.
41324132
*/
4133-
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
4134-
4133+
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
41354134
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
41364135
};
41374136

4138-
/** @deprecated use #do or #tap instead. */
4139-
observableProto.doAction = function () {
4140-
//deprecate('doAction', 'do or tap');
4141-
return this.tap.apply(this, arguments);
4142-
};
4143-
41444137
/**
41454138
* Invokes an action for each element in the observable sequence.
41464139
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.

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: 6 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)