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

Commit 24887ae

Browse files
Fixing ObservableBase for perf for Issue #519
1 parent 33fcd25 commit 24887ae

19 files changed

Lines changed: 72 additions & 64 deletions

dist/rx.all.compat.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,11 @@
23672367
if (currentThreadScheduler.scheduleRequired()) {
23682368
currentThreadScheduler.scheduleWithState(ado, function (_, ado) { return self.scheduledSubscribe(_, ado); })
23692369
} else {
2370-
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2370+
try {
2371+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2372+
} catch (e) {
2373+
if (!ado.fail(e)) { throw e; }
2374+
}
23712375
}
23722376

23732377
return ado;
@@ -2377,13 +2381,11 @@
23772381
__super__.call(this, subscribe);
23782382
}
23792383

2380-
ObservableBase.prototype.scheduledSubscribe = function (_, autoDetachObserver) {
2384+
ObservableBase.prototype.scheduledSubscribe = function (_, ado) {
23812385
try {
2382-
autoDetachObserver.setDisposable(fixSubscriber(this.subscribeCore(autoDetachObserver)));
2386+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
23832387
} catch (e) {
2384-
if (!autoDetachObserver.fail(e)) {
2385-
throw e;
2386-
}
2388+
if (!ado.fail(e)) { throw e; }
23872389
}
23882390
return disposableEmpty;
23892391
};
@@ -9704,7 +9706,6 @@
97049706
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
97059707
inherits(AnonymousObservable, __super__);
97069708

9707-
// Fix subscriber to check for undefined or function returned to decorate as Disposable
97089709
function fixSubscriber(subscriber) {
97099710
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
97109711

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: 3 additions & 3 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: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,11 @@
21782178
if (currentThreadScheduler.scheduleRequired()) {
21792179
currentThreadScheduler.scheduleWithState(ado, function (_, ado) { return self.scheduledSubscribe(_, ado); })
21802180
} else {
2181-
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2181+
try {
2182+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2183+
} catch (e) {
2184+
if (!ado.fail(e)) { throw e; }
2185+
}
21822186
}
21832187

21842188
return ado;
@@ -2188,13 +2192,11 @@
21882192
__super__.call(this, subscribe);
21892193
}
21902194

2191-
ObservableBase.prototype.scheduledSubscribe = function (_, autoDetachObserver) {
2195+
ObservableBase.prototype.scheduledSubscribe = function (_, ado) {
21922196
try {
2193-
autoDetachObserver.setDisposable(fixSubscriber(this.subscribeCore(autoDetachObserver)));
2197+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
21942198
} catch (e) {
2195-
if (!autoDetachObserver.fail(e)) {
2196-
throw e;
2197-
}
2199+
if (!ado.fail(e)) { throw e; }
21982200
}
21992201
return disposableEmpty;
22002202
};
@@ -9447,7 +9449,6 @@
94479449
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
94489450
inherits(AnonymousObservable, __super__);
94499451

9450-
// Fix subscriber to check for undefined or function returned to decorate as Disposable
94519452
function fixSubscriber(subscriber) {
94529453
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
94539454

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: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rx.compat.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2367,7 +2367,11 @@
23672367
if (currentThreadScheduler.scheduleRequired()) {
23682368
currentThreadScheduler.scheduleWithState(ado, function (_, ado) { return self.scheduledSubscribe(_, ado); })
23692369
} else {
2370-
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2370+
try {
2371+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2372+
} catch (e) {
2373+
if (!ado.fail(e)) { throw e; }
2374+
}
23712375
}
23722376

23732377
return ado;
@@ -2377,13 +2381,11 @@
23772381
__super__.call(this, subscribe);
23782382
}
23792383

2380-
ObservableBase.prototype.scheduledSubscribe = function (_, autoDetachObserver) {
2384+
ObservableBase.prototype.scheduledSubscribe = function (_, ado) {
23812385
try {
2382-
autoDetachObserver.setDisposable(fixSubscriber(this.subscribeCore(autoDetachObserver)));
2386+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
23832387
} catch (e) {
2384-
if (!autoDetachObserver.fail(e)) {
2385-
throw e;
2386-
}
2388+
if (!ado.fail(e)) { throw e; }
23872389
}
23882390
return disposableEmpty;
23892391
};
@@ -4696,7 +4698,6 @@
46964698
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
46974699
inherits(AnonymousObservable, __super__);
46984700

4699-
// Fix subscriber to check for undefined or function returned to decorate as Disposable
47004701
function fixSubscriber(subscriber) {
47014702
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
47024703

dist/rx.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.compat.min.js

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

dist/rx.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,11 @@
21782178
if (currentThreadScheduler.scheduleRequired()) {
21792179
currentThreadScheduler.scheduleWithState(ado, function (_, ado) { return self.scheduledSubscribe(_, ado); })
21802180
} else {
2181-
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2181+
try {
2182+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
2183+
} catch (e) {
2184+
if (!ado.fail(e)) { throw e; }
2185+
}
21822186
}
21832187

21842188
return ado;
@@ -2188,13 +2192,11 @@
21882192
__super__.call(this, subscribe);
21892193
}
21902194

2191-
ObservableBase.prototype.scheduledSubscribe = function (_, autoDetachObserver) {
2195+
ObservableBase.prototype.scheduledSubscribe = function (_, ado) {
21922196
try {
2193-
autoDetachObserver.setDisposable(fixSubscriber(this.subscribeCore(autoDetachObserver)));
2197+
ado.setDisposable(fixSubscriber(this.subscribeCore(ado)));
21942198
} catch (e) {
2195-
if (!autoDetachObserver.fail(e)) {
2196-
throw e;
2197-
}
2199+
if (!ado.fail(e)) { throw e; }
21982200
}
21992201
return disposableEmpty;
22002202
};
@@ -4507,7 +4509,6 @@
45074509
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
45084510
inherits(AnonymousObservable, __super__);
45094511

4510-
// Fix subscriber to check for undefined or function returned to decorate as Disposable
45114512
function fixSubscriber(subscriber) {
45124513
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
45134514

0 commit comments

Comments
 (0)