From b12065dec3f5da96ecf6b6cf7251b2477ec4c123 Mon Sep 17 00:00:00 2001 From: Andre Staltz Date: Wed, 21 Dec 2016 17:06:14 +0200 Subject: [PATCH] perf: update benchmarks --- perf/combine.js | 3 +- perf/dataflow.js | 2 +- perf/filter-map-fusion.js | 2 +- perf/filter-map-reduce.js | 2 +- perf/{switchMap.js => flatten.js} | 2 +- perf/{flatMap.js => flattenConcurrently.js} | 5 ++-- perf/{scan.js => fold.js} | 2 +- perf/merge.js | 2 +- perf/package.json | 31 ++++++++++++--------- 9 files changed, 28 insertions(+), 23 deletions(-) rename perf/{switchMap.js => flatten.js} (99%) rename perf/{flatMap.js => flattenConcurrently.js} (93%) rename perf/{scan.js => fold.js} (99%) diff --git a/perf/combine.js b/perf/combine.js index d8fb466..44a156d 100644 --- a/perf/combine.js +++ b/perf/combine.js @@ -6,7 +6,6 @@ var rxjs = require('@reactivex/rxjs') var kefir = require('kefir'); var bacon = require('baconjs'); var lodash = require('lodash'); -var highland = require('highland'); var runners = require('./runners'); var kefirFromArray = runners.kefirFromArray; @@ -58,7 +57,7 @@ suite .add('rx 5', function(deferred) { runners.runRx5(deferred, rxjs.Observable.combineLatest(rx1, rx2, rx3, add3).filter(even)); - }, options); + }, options) runners.runSuite(suite); diff --git a/perf/dataflow.js b/perf/dataflow.js index 96245e1..c8f6f11 100644 --- a/perf/dataflow.js +++ b/perf/dataflow.js @@ -83,7 +83,7 @@ suite var label = bacon.fromArray(['initial', 'Count is ']); var view = bacon.combineWith(renderWithArgs, label, count); runners.runBacon(deferred, view); - }, options); + }, options) runners.runSuite(suite); diff --git a/perf/filter-map-fusion.js b/perf/filter-map-fusion.js index e48e03a..648c799 100644 --- a/perf/filter-map-fusion.js +++ b/perf/filter-map-fusion.js @@ -56,7 +56,7 @@ suite }) .add('Array', function() { return a.map(add1).filter(odd).map(add1).map(add1).filter(even).reduce(sum, 0); - }); + }) runners.runSuite(suite); diff --git a/perf/filter-map-reduce.js b/perf/filter-map-reduce.js index 2484fa3..d944dc5 100644 --- a/perf/filter-map-reduce.js +++ b/perf/filter-map-reduce.js @@ -56,7 +56,7 @@ suite }) .add('Array', function() { return a.filter(even).map(add1).reduce(sum, 0); - }); + }) runners.runSuite(suite); diff --git a/perf/switchMap.js b/perf/flatten.js similarity index 99% rename from perf/switchMap.js rename to perf/flatten.js index e0da86d..cb0fe85 100644 --- a/perf/switchMap.js +++ b/perf/flatten.js @@ -65,7 +65,7 @@ suite }, options) .add('bacon', function(deferred) { runners.runBacon(deferred, bacon.fromArray(a).flatMapLatest(bacon.fromArray).reduce(0, sum)); - }, options); + }, options) runners.runSuite(suite); diff --git a/perf/flatMap.js b/perf/flattenConcurrently.js similarity index 93% rename from perf/flatMap.js rename to perf/flattenConcurrently.js index 948fccc..63ea9ba 100644 --- a/perf/flatMap.js +++ b/perf/flattenConcurrently.js @@ -7,6 +7,7 @@ var kefir = require('kefir'); var bacon = require('baconjs'); var lodash = require('lodash'); var highland = require('highland'); +var flattenConcurrently = require('../extra/flattenConcurrently').default; var runners = require('./runners'); var kefirFromArray = runners.kefirFromArray; @@ -45,7 +46,7 @@ var options = { suite .add('xstream', function(deferred) { runners.runXStream(deferred, - xs.fromArray(a).map(xs.fromArray).flattenConcurrently().fold(sum, 0).last()); + xs.fromArray(a).map(xs.fromArray).compose(flattenConcurrently).fold(sum, 0).last()); }, options) .add('most', function(deferred) { runners.runMost(deferred, most.from(a).flatMap(most.from).reduce(sum, 0)); @@ -72,7 +73,7 @@ suite }) .add('Array', function() { return arrayFlatMap(identity, a).reduce(sum, 0); - }); + }) runners.runSuite(suite); diff --git a/perf/scan.js b/perf/fold.js similarity index 99% rename from perf/scan.js rename to perf/fold.js index 74700ed..0e8affd 100644 --- a/perf/scan.js +++ b/perf/fold.js @@ -54,7 +54,7 @@ suite }) .add('Array', function() { return arrayScan(sum, 0, a).reduce(passthrough, 0); - }); + }) runners.runSuite(suite); diff --git a/perf/merge.js b/perf/merge.js index 7987fd4..6243d41 100644 --- a/perf/merge.js +++ b/perf/merge.js @@ -83,7 +83,7 @@ suite .add('Array', function() { // "Merge" synchronous arrays by concatenation return Array.prototype.concat.apply([], a).reduce(sum, 0); - }); + }) runners.runSuite(suite); diff --git a/perf/package.json b/perf/package.json index 9fed956..4981396 100644 --- a/perf/package.json +++ b/perf/package.json @@ -1,26 +1,31 @@ { "name": "xstream-perf", "version": "0.0.0", - "description": "Perf tests for most.js", + "description": "Perf tests for xstream", "author": "Andre Staltz (http://andre.staltz.com/)", "license": "MIT", "scripts": { "filter-map-fusion": "node ./filter-map-fusion", "filter-map-reduce": "node ./filter-map-reduce", - "flatMap": "node ./flatMap.js", - "merge": "node ./merge.js", - "scan": "node ./scan.js", - "switchMap": "node ./switchMap", - "start": "npm run filter-map-reduce && npm run filter-map-fusion && npm run flatMap && npm run merge && npm run scan && npm run switchMap" + "flattenConcurrently": "node ./flattenConcurrently", + "merge": "node ./merge", + "combine": "node ./combine", + "fold": "node ./fold", + "flatten": "node ./flatten", + "dataflow": "node ./dataflow", + "start": "npm-run-all filter-map-reduce merge combine flatten fold dataflow flattenConcurrently filter-map-fusion" }, "dependencies": { - "@reactivex/rxjs": "^5.0.0-beta.11", - "baconjs": "^0.7.85", + "@reactivex/rxjs": "5.0.x", + "baconjs": "0.7.x", "benchmark": "github:bestiejs/benchmark.js#master", - "highland": "^2.9.0", - "kefir": "^3.4.0", - "lodash": "^4.15.0", - "most": "^1.0.1", - "rx": "^4.1.0" + "kefir": "3.6.x", + "lodash": "4.17.x", + "highland": "2.10.x", + "most": "1.1.x", + "rx": "4.1.x" + }, + "devDependencies": { + "npm-run-all": "^3.1.2" } }