# The Reactive Scrabble benchmarks

DevFeed: [The Reactive Scrabble benchmarks](<https://devfeed.tech/articles/the-reactive-scrabble-benchmarks-24804.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2016/12/the-reactive-scrabble-benchmarks.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2016-12-27T19:01:00Z

Content type: article

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [High-Performance Computing](<https://devfeed.tech/topics/high-performance-computing.md>)

Tags: [2015](<https://devfeed.tech/tags/2015.md>), [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [data](<https://devfeed.tech/tags/data.md>), [data-processing](<https://devfeed.tech/tags/data-processing.md>), [developer-preview](<https://devfeed.tech/tags/developer-preview.md>), [java-8](<https://devfeed.tech/tags/java-8.md>), [library](<https://devfeed.tech/tags/library.md>), [parallel](<https://devfeed.tech/tags/parallel.md>), [performance](<https://devfeed.tech/tags/performance.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [rules](<https://devfeed.tech/tags/rules.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [schema](<https://devfeed.tech/tags/schema.md>), [scrabble](<https://devfeed.tech/tags/scrabble.md>), [stream](<https://devfeed.tech/tags/stream.md>)

## AI overview

The Shakespeare Plays (Reactive) Scrabble benchmark measures how quickly data-processing libraries can find the highest-scoring Scrabble word from Shakespeare's works. Designed by Jose Paumard and run with JMH, its synchronous version compares sequential processing, while a parallel Java Streams variant parallelizes the main loop before combining the result. The excerpt reports that, at the time, RxJava 1.0.x ran about 10 times slower than Java 8 Streams, likely due to operator overhead, and that an RxJava 2 developer preview also performed poorly in tests on a weak CPU. The author describes investigating the benchmark's expectations to improve RxJava performance; the excerpt begins explaining the Stream implementation and its inputs.

## Source excerpt

Introduction In the past year, I've been posting benchmark results under the mysterious Shakespeare Plays (Reactive) Scrabble name. In this blog post, I'll explain what this benchmark is, where does it come from, how it works, what the intent is and how to apply it to your favorite and not-yet-benchmarked library. History The benchmark was designed and developed by Jose Paumard and results presented in his 2015 Devoxx talk (a bit long but worth watching). The benchmark measures how fast a certain data-processing library can find the most valuable word from a set of words taken from (one of) Shakespeare's work based on the rules and point schema of Scrabble. RxJava at the time was in its 1.0.x version and to my surprise, it performed poorly compared to Java 8 Streams: https://youtu.be/fabN6HNZ2qY?t=8369 The benchmark, utilizing JMH, is completely synchronous; no thread hopping happens yet RxJava performs 10x slower, or more likely, it has 10x more overhead in the associated set of operators. In addition, Jose also added a parallel-stream version which runs the main "loop" in parallel before joining for the final result. More disappointingly, RxJava 2 developer preview the time was terrible as well (relatively, measured on a weak CPU in February). Therefore, instead of blaming the benchmark or the author, I set out on a quest to understand the benchmark's expectations and improve RxJava 2's performance and if possible, port that back to RxJava 1. The original Stream-benchmark Perhaps the most easy way to understand how the computation in the benchmark works, Let's see the original, non-parallel Stream version of it. Since going sequential or parallel requires only a sequential() or parallel() operator on a Stream, they both extend an abstract superclass containing the majority of the code and only get specialized for the operation mode in two additional classes. ShakespearePlaysScrabbleWithStreamBeta.java I added postfix "Beta" - meaning alternate version in this cont