From bd1669f0ec0640e21709269759b5bd6ac98eed47 Mon Sep 17 00:00:00 2001 From: Ben Lesh Date: Thu, 1 Oct 2015 18:03:57 -0700 Subject: [PATCH] chore(micro perf): make the proper old Rx version show up in tests --- perf/micro/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/perf/micro/index.js b/perf/micro/index.js index c0225f32c5..ce1a5654d1 100644 --- a/perf/micro/index.js +++ b/perf/micro/index.js @@ -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) { @@ -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 });