|
Control.Concurrent.Configuration |
|
|
|
|
Description |
This module can be used to optimize any complex computation that can be broken down into parallelizable
sub-computations. The computations in question may be pure values, monadic values, list or stream transformations or
anything else provided that it's parallelizable and has a relatively predictable computation cost. Each elementary
sub-computation needs to be packaged as a Component using the constructor atomic. Sub-computations can then be
combined into larger computations using the other constructors.
|
|
Synopsis |
|
|
|
|
The Component type
|
|
|
A Component carries a value and metadata about the value. It can be configured to use a specific number of
threads.
| Constructors | Component | | name :: String | Readable component name.
| subComponents :: [AnyComponent] | Returns the list of all children components.
| maxUsableThreads :: Int | Returns the maximum number of threads that can be used by the component.
| usingThreads :: Int -> Component c | Configures the component to use the specified number of threads. This function affects usedThreads, cost,
and subComponents methods of the result, while name and maxUsableThreads remain the same.
| usedThreads :: Int | The number of threads that the component is configured to use. The default number is usually 1.
| cost :: Int | The cost of using the component as configured. The cost is a rough approximation of time it would take to do the
job given the usedThreads.
| with :: c | The content.
|
|
|
|
|
Utility functions
|
|
|
Show details of the given component's configuration.
|
|
Constructors
|
|
|
Function atomic takes the component name and its cost creates a single-threaded component with no subcomponents.
|
|
|
:: Int | combinator cost
| -> String | name
| -> (c1 -> c2) | combinator
| -> Component c1 | | -> Component c2 | | Applies a unary combinator to the component payload. The resulting component has the original one as its
subComponents, and its cost is the sum of the original component's cost and the combinator cost.
|
|
|
|
Combines two components into one, applying combinator to their contents. The combinator takes a flag denoting
if its arguments should run in parallel. The cost and usingThreads of the result assume the parallel execution of
the argument components.
|
|
|
Combines two components into one, applying combinator to their contents. The cost and usingThreads of the
result assume the sequential execution of the argument components.
|
|
|
Combines three components into one. The first component runs in parallel with the latter two, which are considered
alternative to each other.
|
|
|
Builds a tree of recursive components. The combinator takes a list of pairs of a boolean flag denoting whether the
level should be run in parallel and the value.
|
|
Produced by Haddock version 2.7.2 |