Skip to content

Commit

Permalink
chore(test): add micro-benchmark performance test for repeat operator
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and benlesh committed Aug 31, 2015
1 parent a0c47d6 commit f64b81b
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/repeat.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 oldRepeatWithCurrentThreadScheduler = RxOld.Observable.just(25, RxOld.Scheduler.currentThread).repeat(5, RxOld.Scheduler.currentThread);
var newRepeatWithCurrentThreadScheduler = RxNew.Observable.just(25, RxNew.Scheduler.immediate).repeat(5, RxNew.Scheduler.immediate);

return suite
.add('old repeat with current thread scheduler', function () {
oldRepeatWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
})
.add('new repeat with current thread scheduler', function () {
newRepeatWithCurrentThreadScheduler.subscribe(_next, _error, _complete);
});

function _next(x) { }
function _error(e){ }
function _complete(){ }
};
20 changes: 20 additions & 0 deletions perf/micro/immediate-scheduler/operators/repeat.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 oldRepeatWithImmediateScheduler = RxOld.Observable.just(25, RxOld.Scheduler.immediate).repeat(5, RxOld.Scheduler.immediate);
var newRepeatWithImmediateScheduler = RxNew.Observable.just(25).repeat(5);

return suite
.add('old repeat with immediate scheduler', function () {
oldRepeatWithImmediateScheduler.subscribe(_next, _error, _complete);
})
.add('new repeat with immediate scheduler', function () {
newRepeatWithImmediateScheduler.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 @@ -20,6 +20,7 @@ Observable.from([
require("./immediate-scheduler/operators/filter"),
require("./immediate-scheduler/operators/merge"),
require("./immediate-scheduler/operators/reduce"),
require("./immediate-scheduler/operators/repeat"),

require("./immediate-scheduler/operators/flat-map"),
require("./immediate-scheduler/operators/flat-map-scalar"),
Expand Down Expand Up @@ -48,6 +49,7 @@ Observable.from([
require("./current-thread-scheduler/operators/filter"),
require("./current-thread-scheduler/operators/merge"),
require("./current-thread-scheduler/operators/reduce"),
require("./current-thread-scheduler/operators/repeat"),

require("./current-thread-scheduler/operators/flat-map"),
require("./current-thread-scheduler/operators/flat-map-scalar"),
Expand Down

0 comments on commit f64b81b

Please sign in to comment.