Jape can help you to understand and optimize the performance of complicated processes visualizing execution time and dependencies between process's stages. In modern Java application which uses asynchronous computing with tools like CompletableFuture, parallel streams or RXJava it's sometimes tricky to see which parts are executed sequentially and which parallelly and what stages should be optimized to optimize the whole process.
Following examples show how delegating steps to separate threads can increase concurrency.
Observable.range(0,5)
.map(this::map)
.filter(this::filter)
.scan(this::sum)
.subscribe(this::subscribe);
Observable.range(0,5)
.observeOn(Schedulers.computation())
.map(this::map)
.filter(this::filter)
.scan(this::sum)
.subscribe(this::subscribe);
Observable.range(0,5)
.observeOn(Schedulers.computation())
.map(this::map)
.observeOn(Schedulers.computation())
.filter(this::filter)
.scan(this::sum)
.subscribe(this::subscribe);
Observable.range(0,5)
.observeOn(Schedulers.computation())
.map(this::map)
.observeOn(Schedulers.computation())
.filter(this::filter)
.observeOn(Schedulers.computation())
.scan(this::sum)
.subscribe(this::subscribe);
Observable.range(0,5)
.observeOn(Schedulers.computation())
.map(this::map)
.observeOn(Schedulers.computation())
.filter(this::filter)
.observeOn(Schedulers.computation())
.scan(this::sum)
.observeOn(Schedulers.computation())
.subscribe(this::subscribe);
Clone or download the example project
and execute command:
Linux
./gradlew run
Windows
gradlew.bat run
The program will start example computation and open url http://localhost:5005 in
a browser. Wait a while to finish some computation and click selected trace to
show the chart:
Live example
The project is at the early experimental stage and should not be used in a production environment.