Browse Source

Use sequential row processing in CropProcessor

pull/3113/head
James Jackson-South 1 month ago
parent
commit
abafe100cd
  1. 14
      src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs

14
src/ImageSharp/Processing/Processors/Transforms/CropProcessor{TPixel}.cs

@ -59,16 +59,14 @@ internal class CropProcessor<TPixel> : TransformProcessor<TPixel>
Rectangle bounds = this.cropRectangle;
// Copying is cheap, we should process more pixels per task:
ParallelExecutionSettings parallelSettings =
ParallelExecutionSettings.FromConfiguration(this.Configuration).MultiplyMinimumPixelsPerTask(4);
// Copying is too cheap to benefit from parallelization;
// the overhead exceeds the work per task. See #3111.
RowOperation operation = new(bounds, source.PixelBuffer, destination.PixelBuffer);
ParallelRowIterator.IterateRows(
bounds,
in parallelSettings,
in operation);
for (int y = bounds.Top; y < bounds.Bottom; y++)
{
operation.Invoke(y);
}
}
/// <summary>

Loading…
Cancel
Save