Skip to content

Commit abafe10

Browse files
Use sequential row processing in CropProcessor
1 parent a9c43dc commit abafe10

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,14 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, ImageFrame<TPixe
5959

6060
Rectangle bounds = this.cropRectangle;
6161

62-
// Copying is cheap, we should process more pixels per task:
63-
ParallelExecutionSettings parallelSettings =
64-
ParallelExecutionSettings.FromConfiguration(this.Configuration).MultiplyMinimumPixelsPerTask(4);
65-
62+
// Copying is too cheap to benefit from parallelization;
63+
// the overhead exceeds the work per task. See #3111.
6664
RowOperation operation = new(bounds, source.PixelBuffer, destination.PixelBuffer);
6765

68-
ParallelRowIterator.IterateRows(
69-
bounds,
70-
in parallelSettings,
71-
in operation);
66+
for (int y = bounds.Top; y < bounds.Bottom; y++)
67+
{
68+
operation.Invoke(y);
69+
}
7270
}
7371

7472
/// <summary>

0 commit comments

Comments
 (0)