Skip to content

Commit

Permalink
chore(test): add micro-benchmark performance test for startwith operator
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and benlesh committed Sep 3, 2015
1 parent 492f594 commit 2028a61
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
20 changes: 20 additions & 0 deletions perf/micro/current-thread-scheduler/operators/start-with.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var RxOld = require("rx");
var RxNew = require("../../../../index");

module.exports = function (suite) {

var oldStartWithWithCurrentThreadScheduler = RxOld.Observable.of(25, RxOld.Scheduler.currentThread).startWith(5, RxOld.Scheduler.currentThread);
var newStartWithWithCurrentThreadScheduler = RxNew.Observable.of(25, RxNew.Scheduler.immediate).startWith(5, RxNew.Scheduler.immediate);

return suite
.add('old startWith with current thread scheduler', function () {
oldStartWithWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
})
.add('new startWith with current thread scheduler', function () {
newStartWithWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
});

function _next(x) { }
function _error(e){ }
function _complete(){ }
};
20 changes: 20 additions & 0 deletions perf/micro/immediate-scheduler/operators/start-with.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var RxOld = require("rx");
var RxNew = require("../../../../index");

module.exports = function (suite) {

var oldStartWithWithImmediateScheduler = RxOld.Observable.of(25, RxOld.Scheduler.immediate).startWith(5, RxOld.Scheduler.immediate);
var newStartWithWithImmediateScheduler = RxNew.Observable.of(25).startWith(5);

return suite
.add('old startWith with immediate scheduler', function () {
oldStartWithWithImmediateScheduler.subscribe(_next, _error, _complete);
})
.add('new startWith with immediate scheduler', function () {
newStartWithWithImmediateScheduler.subscribe(_next, _error, _complete);
});

function _next(x) { }
function _error(e){ }
function _complete(){ }
};
2 changes: 2 additions & 0 deletions perf/micro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Observable.from([
require("./immediate-scheduler/operators/map"),
require("./immediate-scheduler/operators/scan"),
require("./immediate-scheduler/operators/skip"),
require("./immediate-scheduler/operators/start-with"),
require("./immediate-scheduler/operators/take"),
require("./immediate-scheduler/operators/to-array"),
require("./immediate-scheduler/operators/zip"),
Expand Down Expand Up @@ -61,6 +62,7 @@ Observable.from([
require("./current-thread-scheduler/operators/map"),
require("./current-thread-scheduler/operators/scan"),
require("./current-thread-scheduler/operators/skip"),
require("./current-thread-scheduler/operators/start-with"),
require("./current-thread-scheduler/operators/take"),
require("./current-thread-scheduler/operators/to-array"),
require("./current-thread-scheduler/operators/zip"),
Expand Down

0 comments on commit 2028a61

Please sign in to comment.