Browse Source

Use sequential row processing in CropProcessor

pull/3113/head
James Jackson-South 6 months 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; Rectangle bounds = this.cropRectangle;
// Copying is cheap, we should process more pixels per task: // Copying is too cheap to benefit from parallelization;
ParallelExecutionSettings parallelSettings = // the overhead exceeds the work per task. See #3111.
ParallelExecutionSettings.FromConfiguration(this.Configuration).MultiplyMinimumPixelsPerTask(4);
RowOperation operation = new(bounds, source.PixelBuffer, destination.PixelBuffer); RowOperation operation = new(bounds, source.PixelBuffer, destination.PixelBuffer);
ParallelRowIterator.IterateRows( for (int y = bounds.Top; y < bounds.Bottom; y++)
bounds, {
in parallelSettings, operation.Invoke(y);
in operation); }
} }
/// <summary> /// <summary>

Loading…
Cancel
Save