-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(distinct): add perf tests for distinct
- Current performance is sub-par, 60% of the speed of Rx 4's operator.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
perf/micro/immediate-scheduler/operators/distinct-keyselector.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var RxOld = require('rx'); | ||
var RxNew = require('../../../../dist/cjs/Rx.KitchenSink'); | ||
|
||
module.exports = function (suite) { | ||
var source = Array.from({ length: 25 }, function (_, i) { return { value: i % 3 }; }); | ||
var _old = RxOld.Observable.fromArray(source).distinct(function (x) { return x.value; }); | ||
var _new = RxNew.Observable.fromArray(source).distinct(function (x) { return x.value; }); | ||
|
||
function _next(x) { } | ||
function _error(e) { } | ||
function _complete() { } | ||
return suite | ||
.add('old count with immediate scheduler', function () { | ||
_old.subscribe(_next, _error, _complete); | ||
}) | ||
.add('new count with immediate scheduler', function () { | ||
_new.subscribe(_next, _error, _complete); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var RxOld = require('rx'); | ||
var RxNew = require('../../../../dist/cjs/Rx.KitchenSink'); | ||
|
||
module.exports = function (suite) { | ||
var source = Array.from({ length: 25 }, function (_, i) { return i % 3; }); | ||
var _old = RxOld.Observable.fromArray(source).distinct(); | ||
var _new = RxNew.Observable.fromArray(source).distinct(); | ||
|
||
function _next(x) { } | ||
function _error(e) { } | ||
function _complete() { } | ||
return suite | ||
.add('old count with immediate scheduler', function () { | ||
_old.subscribe(_next, _error, _complete); | ||
}) | ||
.add('new count with immediate scheduler', function () { | ||
_new.subscribe(_next, _error, _complete); | ||
}); | ||
}; |