-
Notifications
You must be signed in to change notification settings - Fork 136
Automatic Optimization [autoOptimize]
johnmcclean-aol edited this page Sep 9, 2015
·
2 revisions
The autoOptimize facility introduced in simple-react v0.99.1 helps to efficiently distribute your tasks over multiple threads. simple-react LazyFutureStreams are especially well suited for handling tasks related to blocking I/O, and autoOptmize makes it especially easy to, for example, make multiple rest calls (or load multiple files) and efficiently process the results.
Automatic Optimization is a available as an option on the LazyReact builder and is on by default. Automatic Optimization is also switched on for parallel streams created via the creational methods on LazyFutureStream.
new LazyReact().autoOptimizeOn()
.range(0, 1_000_000)
.map(this::loadByID)
.map(this::process)
.flatMap(Collection::stream)
.filter(this::inScope)
.forEach(this::save);
fan out across threads with autoOptimize
oops - my bad