ReactiveX/RxJava — pull request #1924 by akarnokd (2014-12-02 15:59:34+00:00)
Title: Spsc experiments: AtomicArrayQueue

Just for fun, I've tried to implement an SPSC ArrayQueue which can resize itself on demand, aimed mainly for using with merge(). Some other classes are from #1909.

Running
```
gradlew benchmarks "-Pjmh=-f 1 -tu s -bm thrpt -wi 5 -i 5 -r 1 .*ConcurrentQueueThroughputBusy.*"
```

Gives me generally nice performance but with high error:

```
Benchmark Mode Samples Score Score error Units
r.i.ConcurrentQueueThroughputBusy.tpt thrpt 5 39270769,666 13360732,543 ops/s
r.i.ConcurrentQueueThroughputBusy.tpt:offer thrpt 5 19789356,594 6803017,182 ops/s
r.i.ConcurrentQueueThroughputBusy.tpt:poll thrpt 5 19481413,072 6575732,347 ops/s
```

In comparison, the SpscLinkedQueue of #1909 performs better:
```
Benchmark Mode Samples Score Score error Units
r.i.ConcurrentQueueThroughputBusy.tpt thrpt 5 46097687,727 15813637,226 ops/s
r.i.ConcurrentQueueThroughputBusy.tpt:offer thrpt 5 23048904,994 7907022,271 ops/s
r.i.ConcurrentQueueThroughputBusy.tpt:poll thrpt 5 23048782,733 7906615,063 ops/s
```

Don't know if various padding techniques could help or not. Hopefully, experts such as @nitsanw can review this and tell if it's worth pursuing or not.