-
Notifications
You must be signed in to change notification settings - Fork 3
Parallel
The parallel implementation makes heavy use of the Thread Pool Infrastructure. It is mainly a convenience API that automatically splits the work and joins the sub-results to have a greater benefit of the available computation hardware.
IParallel
is the main facade allowing to create IParallelChain
objects. The API is reactive.
Allows to configure the operations to perform for an IParallelJob
in a descriptive way.
parallel
.range(10)
.map(i => i * 2)
.then(result => console.log(result));
Each chained method returns a new IParallelChain
instance that represents the operations to perform up to this moment. The result of a chain can be accessed using then
, catch
or subscribe
.
Implementation of the IParallelChain
. Uses an internal IParallelChainState
to distinguishes if the chain has not yet been scheduled (PendingParallelChainState
), the parallel job is scheduled — maybe even complete — (ScheduledParallelChainState
), or if the chain needs to wait for another chain to complete in advance (DependentParallelChainState
).
IParallelJobScheduler
splits the work of an IParallelJob
into ITask
s of reasonable size and runs them on the IThreadPool
.
The IParallelJob
describes a parallel job and all its operations.