Skip to content

Commit 34f110f

Browse files
Add small-geometry fast path to rasterizer
1 parent 8da2642 commit 34f110f

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/ImageSharp.Drawing/Processing/Backends/DefaultRasterizer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,11 @@ private static bool TryRasterizeParallel(
330330
}
331331

332332
int tileCount = (height + tileHeight - 1) / tileHeight;
333-
if (tileCount == 1)
333+
if (tileCount == 1 || edgeCount <= 64)
334334
{
335-
// Tiny workload fast path: avoid bucket construction and worker scheduling
336-
// when everything fits in a single tile.
335+
// Small-geometry fast path: for paths with few edges (e.g. a stroked line
336+
// producing ~6-10 edges), iterating all edges against all rows is far cheaper
337+
// than the allocation overhead of band sorting + Parallel.For scheduling.
337338
RasterizeSingleTileDirect(
338339
edgeMemory.Span[..edgeCount],
339340
width,

0 commit comments

Comments
 (0)