Skip to content

Commit

Permalink
chore(micro perf): make the proper old Rx version show up in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Oct 2, 2015
1 parent 16bd691 commit bd1669f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions perf/micro/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ var suite = new Benchmark.Suite;
var glob = require('glob');
var path = require('path');

var oldRxPackage = JSON.parse(require('fs').readFileSync('node_modules/rx/package.json'));
var oldVersion = oldRxPackage.version;

console.log('Testing against RxJS v ' + oldVersion);

Observable.create(function(observer) {
["perf/micro/immediate-scheduler/**/*.js", "perf/micro/current-thread-scheduler/**/*.js"]
.forEach(function(pattern) {
Expand Down Expand Up @@ -49,9 +54,9 @@ Observable.create(function(observer) {

// percent change formula: ((V2 - V1) / |V1|) * 100
if(fastestName.substr(0, 3) === "new") {
complete.onNext("\t" + (Math.round((fastestTime - slowestTime) / slowestTime * 10000) / 100) + "% " + "faster".green +" than Rx2\n");
complete.onNext("\t" + (Math.round((fastestTime - slowestTime) / slowestTime * 10000) / 100) + "% " + "faster".green +" than Rx v " + oldVersion + "\n");
} else {
complete.onNext("\t" + (Math.round((slowestTime - fastestTime) / fastestTime * 10000) / 100) + "% " + "slower".red + " than Rx2\n");
complete.onNext("\t" + (Math.round((slowestTime - fastestTime) / fastestTime * 10000) / 100) + "% " + "slower".red + " than Rx v " + oldVersion + "\n");
}
}).run({ "async": true });

Expand Down

0 comments on commit bd1669f

Please sign in to comment.