BatchSizeOptimization implements Optimization
FinalYes
The goal of this optimizer is to detect if there is a loader that supports batching and optimize pipeline to use it.
This optimization is only applicable for the pipelines with a default batch size (1).
Be default all extractors are yielding rows one by one, in that case loaders like for example DbalLoader would become a bottleneck because it would execute a single query for each row. This optimization will detect that and will wrap the pipeline with a BatchingPipeline.
Interfaces
Methods
- __construct() : mixed
- isFor() : bool
- optimize() : Pipeline
Methods
__construct()
public
__construct([int<1, max> $batchSize = 1000 ]) : mixed
Parameters
- $batchSize : int<1, max> = 1000
isFor()
public
isFor(Loader|Transformer $element, Pipeline $pipeline) : bool
Parameters
- $element : Loader|Transformer
- $pipeline : Pipeline
Return values
booloptimize()
public
optimize(Loader|Transformer $element, Pipeline $pipeline) : Pipeline
Parameters
- $element : Loader|Transformer
- $pipeline : Pipeline