Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
222 changes: 118 additions & 104 deletions test/perf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,183 +7,197 @@ Latest performance tests of basic most.js operations.

```
> uname -a
Darwin Brians-MBP.home 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
Linux laptop 4.14.56-1-MANJARO #1 SMP PREEMPT Tue Jul 17 13:20:49 UTC 2018 x86_64 GNU/Linux

> npm ls
most-perf@0.10.0 /Users/brian/Projects/cujojs/most/test/perf
├── @reactivex/rxjs@5.0.1
├── baconjs@0.7.89
├── baconjs@2.0.9
├── benchmark@2.1.0 (git://github.com/bestiejs/benchmark.js.git#308cc4c82df602b21bc7775075d43836969a8b16)
├── highland@2.10.1
├── kefir@3.6.1
├── rx@4.1.0
└── xstream@10.0.0
├── rxjs@6.2.2
└── xstream@11.0.0
```

## Node

```
> node --version
v6.9.2
v8.11.3

> npm start

> most-perf@0.10.0 start /Users/brian/Projects/cujojs/most/test/perf
> npm run filter-map-reduce && npm run flatMap && npm run concatMap && npm run merge && npm run merge-nested && npm run zip && npm run scan && npm run slice && npm run skipRepeats
> most-perf@0.10.0 start /home/juan/code/most/test/perf
> npm run filter-map-reduce && npm run flatMap && npm run concatMap && npm run merge && npm run merge-nested && npm run zip && npm run scan && npm run slice && npm run skipRepeats && npm run switch


> most-perf@0.10.0 filter-map-reduce /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 filter-map-reduce /home/juan/code/most/test/perf
> node ./filter-map-reduce

filter -> map -> reduce 1000000 integers
-------------------------------------------------------
most 568.23 op/s ± 1.43% (80 samples)
rx 4 1.45 op/s ± 1.48% (12 samples)
rx 5 11.38 op/s ± 1.29% (55 samples)
xstream 18.41 op/s ± 0.91% (81 samples)
kefir 10.36 op/s ± 1.11% (51 samples)
bacon 0.83 op/s ± 1.93% (9 samples)
highland 4.82 op/s ± 1.90% (27 samples)
most 442.99 op/s ± 1.01% (85 samples)
rx 4 1.95 op/s ± 0.37% (14 samples)
rx 5 103.44 op/s ± 0.92% (81 samples)
rx 6 98.88 op/s ± 1.51% (77 samples)
xstream 21.60 op/s ± 0.73% (55 samples)
kefir 14.11 op/s ± 10.89% (72 samples)
bacon 1.51 op/s ± 3.88% (12 samples)
highland 8.65 op/s ± 2.75% (44 samples)
-------------------------------------------------------

> most-perf@0.10.0 flatMap /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 flatMap /home/juan/code/most/test/perf
> node ./flatMap.js

flatMap 1000 x 1000 streams
-------------------------------------------------------
most 153.71 op/s ± 1.11% (77 samples)
rx 4 0.75 op/s ± 2.24% (8 samples)
rx 5 27.50 op/s ± 0.96% (64 samples)
xstream 11.99 op/s ± 0.98% (57 samples)
kefir 9.30 op/s ± 1.13% (47 samples)
bacon 0.73 op/s ± 1.29% (8 samples)
highland 0.10 op/s ± 3.44% (5 samples)
most 51.93 op/s ± 2.38% (62 samples)
rx 4 0.91 op/s ± 1.23% (9 samples)
rx 5 31.85 op/s ± 1.10% (54 samples)
rx 6 10.10 op/s ± 2.30% (47 samples)
xstream 17.41 op/s ± 1.21% (82 samples)
kefir 16.78 op/s ± 0.94% (80 samples)
bacon 0.61 op/s ± 6.00% (7 samples)
highland 0.14 op/s ± 2.34% (5 samples)
-------------------------------------------------------

> most-perf@0.10.0 concatMap /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 concatMap /home/juan/code/most/test/perf
> node ./concatMap.js

concatMap 1000 x 1000 streams
-------------------------------------------------------
most 103.87 op/s ± 1.24% (77 samples)
rx 4 1.29 op/s ± 11.69% (11 samples)
rx 5 29.58 op/s ± 1.12% (68 samples)
xstream 12.37 op/s ± 0.95% (59 samples)
kefir 10.13 op/s ± 0.99% (50 samples)
bacon 0.70 op/s ± 3.40% (8 samples)
most 52.01 op/s ± 4.35% (40 samples)
rx 4 1.82 op/s ± 0.86% (14 samples)
rx 5 26.90 op/s ± 1.33% (46 samples)
rx 6 10.82 op/s ± 2.47% (50 samples)
xstream 16.80 op/s ± 1.21% (79 samples)
kefir 16.53 op/s ± 0.79% (79 samples)
bacon 0.60 op/s ± 6.17% (7 samples)
-------------------------------------------------------

> most-perf@0.10.0 merge /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 merge /home/juan/code/most/test/perf
> node ./merge.js

merge 100000 x 10 streams
-------------------------------------------------------
most 315.04 op/s ± 1.62% (79 samples)
rx 4 1.36 op/s ± 1.59% (11 samples)
rx 5 30.42 op/s ± 1.00% (69 samples)
xstream 16.87 op/s ± 1.15% (75 samples)
kefir 11.63 op/s ± 1.75% (56 samples)
bacon 0.74 op/s ± 2.53% (8 samples)
most 159.18 op/s ± 25.88% (43 samples)
rx 4 1.51 op/s ± 1.02% (12 samples)
rx 5 74.69 op/s ± 1.00% (86 samples)
rx 6 76.16 op/s ± 0.71% (88 samples)
xstream 38.17 op/s ± 1.62% (64 samples)
kefir 17.49 op/s ± 1.88% (83 samples)
bacon 1.53 op/s ± 2.75% (12 samples)
-------------------------------------------------------

> most-perf@0.10.0 merge-nested /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 merge-nested /home/juan/code/most/test/perf
> node ./merge-nested.js

merge nested streams w/depth 2, 5, 10, 100 (10000 items in each stream)
-------------------------------------------------------
most (depth 2) 11914.82 op/s ± 0.81% (79 samples)
most (depth 5) 6218.70 op/s ± 1.12% (78 samples)
most (depth 10) 3524.94 op/s ± 1.19% (81 samples)
most (depth 100) 305.40 op/s ± 1.89% (79 samples)
rx 4 (depth 2) 45.61 op/s ± 1.10% (69 samples)
rx 4 (depth 5) 16.34 op/s ± 0.95% (73 samples)
rx 4 (depth 10) 6.79 op/s ± 2.28% (36 samples)
rx 4 (depth 100) 0.18 op/s ± 2.54% (5 samples)
rx 5 (depth 2) 678.24 op/s ± 1.45% (79 samples)
rx 5 (depth 5) 268.50 op/s ± 2.52% (78 samples)
rx 5 (depth 10) 77.43 op/s ± 5.12% (60 samples)
rx 5 (depth 100) 1.63 op/s ± 5.42% (13 samples)
xstream (depth 2) 373.53 op/s ± 3.37% (61 samples)
xstream (depth 5) 152.53 op/s ± 3.18% (64 samples)
xstream (depth 10) 66.73 op/s ± 2.52% (63 samples)
xstream (depth 100) 1.32 op/s ± 1.01% (11 samples)
kefir (depth 2) 218.64 op/s ± 3.61% (62 samples)
kefir (depth 5) 79.75 op/s ± 2.76% (62 samples)
kefir (depth 10) 31.82 op/s ± 3.25% (72 samples)
kefir (depth 100) 0.47 op/s ± 2.10% (7 samples)
bacon (depth 2) 17.35 op/s ± 3.18% (48 samples)
bacon (depth 5) 7.33 op/s ± 2.98% (38 samples)
bacon (depth 10) 3.34 op/s ± 3.44% (20 samples)
bacon (depth 100) 0.08 op/s ± 3.85% (5 samples)
highland (depth 2) 1.75 op/s ± 13.30% (13 samples)
highland (depth 5) 1.78 op/s ± 9.74% (13 samples)
highland (depth 10) 0.14 op/s ± 2.89% (5 samples)
-------------------------------------------------------

> most-perf@0.10.0 zip /Users/brian/Projects/cujojs/most/test/perf
most (depth 2) 6088.23 op/s ± 15.66% (45 samples)
most (depth 5) 2015.35 op/s ± 0.78% (89 samples)
most (depth 10) 1102.96 op/s ± 0.77% (90 samples)
most (depth 100) 351.16 op/s ± 1.19% (85 samples)
rx 4 (depth 2) 54.18 op/s ± 1.26% (84 samples)
rx 4 (depth 5) 20.67 op/s ± 1.48% (53 samples)
rx 4 (depth 10) 8.64 op/s ± 0.36% (45 samples)
rx 4 (depth 100) 0.28 op/s ± 0.88% (6 samples)
rx 5 (depth 2) 944.78 op/s ± 2.70% (51 samples)
rx 5 (depth 5) 381.93 op/s ± 0.56% (88 samples)
rx 5 (depth 10) 156.86 op/s ± 0.97% (81 samples)
rx 5 (depth 100) 3.00 op/s ± 2.15% (19 samples)
rx 6 (depth 2) 2323.60 op/s ± 0.93% (86 samples)
rx 6 (depth 5) 1195.30 op/s ± 0.46% (90 samples)
rx 6 (depth 10) 648.01 op/s ± 0.97% (87 samples)
rx 6 (depth 100) 73.82 op/s ± 1.03% (86 samples)
xstream (depth 2) 1188.25 op/s ± 1.05% (87 samples)
xstream (depth 5) 397.85 op/s ± 1.15% (87 samples)
xstream (depth 10) 150.90 op/s ± 0.90% (87 samples)
xstream (depth 100) 2.22 op/s ± 2.23% (16 samples)
kefir (depth 2) 465.83 op/s ± 1.45% (85 samples)
kefir (depth 5) 147.50 op/s ± 1.19% (85 samples)
kefir (depth 10) 52.65 op/s ± 1.46% (81 samples)
kefir (depth 100) 0.62 op/s ± 10.64% (8 samples)
bacon (depth 2) 39.17 op/s ± 4.49% (64 samples)
bacon (depth 5) 19.09 op/s ± 1.54% (52 samples)
bacon (depth 10) 9.11 op/s ± 0.91% (47 samples)
bacon (depth 100) 0.20 op/s ± 3.08% (6 samples)
highland (depth 2) 3.15 op/s ± 2.60% (20 samples)
highland (depth 5) 3.18 op/s ± 1.47% (20 samples)
highland (depth 10) 0.23 op/s ± 0.48% (6 samples)
-------------------------------------------------------

> most-perf@0.10.0 zip /home/juan/code/most/test/perf
> node ./zip.js

zip 2 x 100000 integers
-------------------------------------------------------
most 91.66 op/s ± 3.23% (61 samples)
rx 4 2.15 op/s ± 2.07% (15 samples)
rx 5 0.20 op/s ± 1.33% (5 samples)
kefir 0.46 op/s ± 51.48% (7 samples)
bacon 0.10 op/s ± 8.01% (5 samples)
highland 0.06 op/s ± 7.44% (5 samples)
most 126.54 op/s ± 1.65% (78 samples)
rx 4 6.46 op/s ± 1.27% (35 samples)
rx 5 0.26 op/s ± 0.75% (6 samples)
rx 6 0.26 op/s ± 0.68% (6 samples)
kefir 0.74 op/s ± 53.83% (9 samples)
bacon 0.08 op/s ± 21.13% (5 samples)
highland 0.09 op/s ± 4.67% (5 samples)
-------------------------------------------------------

> most-perf@0.10.0 scan /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 scan /home/juan/code/most/test/perf
> node ./scan.js

scan -> reduce 1000000 integers
-------------------------------------------------------
most 304.14 op/s ± 1.02% (75 samples)
rx 4 1.19 op/s ± 2.28% (10 samples)
rx 5 10.06 op/s ± 2.30% (50 samples)
xstream 7.87 op/s ± 1.25% (40 samples)
kefir 12.76 op/s ± 2.15% (59 samples)
bacon 0.59 op/s ± 4.14% (7 samples)
highland 4.91 op/s ± 3.29% (27 samples)
most 351.48 op/s ± 0.88% (84 samples)
rx 4 1.85 op/s ± 0.43% (14 samples)
rx 5 26.23 op/s ± 2.00% (65 samples)
rx 6 24.97 op/s ± 1.67% (62 samples)
xstream 20.97 op/s ± 1.20% (53 samples)
kefir 19.06 op/s ± 17.83% (54 samples)
bacon 1.02 op/s ± 9.01% (9 samples)
highland 9.04 op/s ± 1.80% (45 samples)
-------------------------------------------------------

> most-perf@0.10.0 slice /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 slice /home/juan/code/most/test/perf
> node ./slice.js

skip(n/4) -> take(n/2) 1000000 integers
-------------------------------------------------------
most 101.20 op/s ± 1.77% (65 samples)
rx 4 2.00 op/s ± 1.90% (14 samples)
rx 5 40.24 op/s ± 1.81% (62 samples)
xstream 17.89 op/s ± 2.65% (42 samples)
kefir 9.87 op/s ± 7.09% (51 samples)
bacon 0.84 op/s ± 2.23% (9 samples)
highland 6.17 op/s ± 2.67% (33 samples)
most 250.26 op/s ± 0.68% (89 samples)
rx 4 2.80 op/s ± 0.51% (18 samples)
rx 5 139.49 op/s ± 1.01% (81 samples)
rx 6 135.73 op/s ± 0.53% (89 samples)
xstream 25.76 op/s ± 0.59% (60 samples)
kefir 15.98 op/s ± 6.22% (78 samples)
bacon 1.82 op/s ± 2.15% (13 samples)
highland 9.69 op/s ± 2.25% (47 samples)
-------------------------------------------------------

> most-perf@0.10.0 skipRepeats /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 skipRepeats /home/juan/code/most/test/perf
> node ./skipRepeats.js

skipRepeats -> reduce 2 x 1000000 integers
-------------------------------------------------------
most 327.55 op/s ± 1.01% (76 samples)
rx 4 1.60 op/s ± 1.40% (12 samples)
rx 5 10.71 op/s ± 1.74% (52 samples)
xstream 18.89 op/s ± 1.82% (47 samples)
kefir 10.99 op/s ± 2.19% (53 samples)
bacon 0.73 op/s ± 1.89% (8 samples)
most 372.24 op/s ± 1.04% (86 samples)
rx 4 2.15 op/s ± 0.60% (15 samples)
rx 5 27.13 op/s ± 1.22% (66 samples)
rx 6 25.03 op/s ± 1.25% (62 samples)
xstream 54.87 op/s ± 2.64% (86 samples)
kefir 20.27 op/s ± 17.96% (57 samples)
bacon 1.63 op/s ± 3.50% (12 samples)
-------------------------------------------------------

> most-perf@0.10.0 switch /Users/brian/Projects/cujojs/most/test/perf
> most-perf@0.10.0 switch /home/juan/code/most/test/perf
> node ./switch.js

switch 10000 x 1000 streams
-------------------------------------------------------
most 1426.42 op/s ± 1.28% (81 samples)
rx 5 1.65 op/s ± 6.74% (12 samples)
rx 4 95.93 op/s ± 3.47% (72 samples)
xstream 1.32 op/s ± 5.03% (11 samples)
kefir 1.05 op/s ± 1.37% (10 samples)
bacon 0.03 op/s ± 1.75% (5 samples)
most 1815.98 op/s ± 1.65% (84 samples)
rx 4 130.78 op/s ± 1.07% (86 samples)
rx 5 3.72 op/s ± 9.37% (21 samples)
rx 6 7.06 op/s ± 1.90% (38 samples)
xstream 1.80 op/s ± 1.31% (13 samples)
kefir 1.62 op/s ± 1.61% (12 samples)
bacon 0.02 op/s ± 5.26% (5 samples)
-------------------------------------------------------
```
Done in 1124.62s.
9 changes: 9 additions & 0 deletions test/perf/concatMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ var Benchmark = require('benchmark');
var most = require('../../src/index');
var rx = require('rx');
var rxjs = require('@reactivex/rxjs');
var rxjs6 = require('rxjs');
var rxjs6Operators = require('rxjs/operators');
var kefir = require('kefir');
var bacon = require('baconjs');
var xs = require('xstream').default;
Expand Down Expand Up @@ -52,6 +54,13 @@ suite
.add('rx 5', function(deffered) {
runners.runRx5(deffered, rxjs.Observable.from(a).concatMap(function(x) {return rxjs.Observable.from(x)}).reduce(sum, 0))
}, options)
.add('rx 6', function(deffered) {
runners.runRx6(deffered,
rxjs6.of(a).pipe(
rxjs6Operators.concatMap(function(x) {return rxjs6.from(x)}),
rxjs6Operators.reduce(sum, 0))
)
}, options)
.add('xstream', function(deferred) {
runners.runXstream(deferred, xs.fromArray(a).map(xs.fromArray).compose(xstreamFlattenSequentially).fold(sum, 0).last())
}, options)
Expand Down
12 changes: 11 additions & 1 deletion test/perf/filter-map-reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ require('buba/register')
var Benchmark = require('benchmark');
var most = require('../../src/index');
var rx = require('rx');
var rxjs = require('@reactivex/rxjs')
var rxjs = require('@reactivex/rxjs');
var rxjs6 = require('rxjs');
var rxjs6Operators = require('rxjs/operators');
var kefir = require('kefir');
var bacon = require('baconjs');
var highland = require('highland');
Expand Down Expand Up @@ -38,6 +40,14 @@ suite
runners.runRx5(deferred,
rxjs.Observable.from(a).filter(even).map(add1).reduce(sum, 0));
}, options)
.add('rx 6', function(deferred) {
runners.runRx6(deferred,
rxjs6.from(a).pipe(
rxjs6Operators.filter(even),
rxjs6Operators.map(add1),
rxjs6Operators.reduce(sum, 0))
)
}, options)
.add('xstream', function(deferred) {
runners.runXstream(deferred, xs.fromArray(a).filter(even).map(add1).fold(sum, 0).last())
}, options)
Expand Down
11 changes: 10 additions & 1 deletion test/perf/flatMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ require('buba/register')
var Benchmark = require('benchmark');
var most = require('../../src/index');
var rx = require('rx');
var rxjs = require('@reactivex/rxjs')
var rxjs = require('@reactivex/rxjs');
var rxjs6 = require('rxjs');
var rxjs6Operators = require('rxjs/operators');
var kefir = require('kefir');
var bacon = require('baconjs');
var highland = require('highland');
Expand Down Expand Up @@ -55,6 +57,13 @@ suite
rxjs.Observable.from(a).flatMap(
function(x) {return rxjs.Observable.from(x)}).reduce(sum, 0))
}, options)
.add('rx 6', function(deferred) {
runners.runRx6(deferred,
rxjs6.from(a).pipe(
rxjs6Operators.flatMap(function(x) {return rxjs6.of(x)}),
rxjs6Operators.reduce(sum, 0))
)
}, options)
.add('xstream', function(deferred) {
runners.runXstream(deferred, xs.fromArray(a).map(xs.fromArray).compose(xstreamFlattenConcurrently).fold(sum, 0).last());
}, options)
Expand Down
Loading