Skip to content

Speed up rectangle, polygon and line drawing#9772

Open
akx wants to merge 5 commits into
python-pillow:mainfrom
akx:faster-rect-and-line
Open

Speed up rectangle, polygon and line drawing#9772
akx wants to merge 5 commits into
python-pillow:mainfrom
akx:faster-rect-and-line

De-triplicate Bresenham walkers; use hline when possible

0355c20
Select commit
Loading
Failed to load commit list.
CodSpeed HQ / CodSpeed Performance Analysis succeeded Jul 6, 2026 in 0s

Performance Gate Passed

✅ 345 untouched benchmarks
🆕 12 new benchmarks
⏩ 2 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_draw_lines_blend[1024x1024-0] N/A 42.6 µs N/A
🆕 test_draw_lines_blend[1024x1024-127] N/A 451.9 µs N/A
🆕 test_draw_lines_blend[1024x1024-255] N/A 245.9 µs N/A
🆕 test_draw_lines[1024x1024-L] N/A 345.9 µs N/A
🆕 test_draw_lines[1024x1024-LA] N/A 220.4 µs N/A
🆕 test_draw_lines[1024x1024-RGB] N/A 226.5 µs N/A
🆕 test_draw_lines[1024x1024-RGBA] N/A 220.2 µs N/A
🆕 test_draw_rectangle_blend[1024x1024] N/A 12.9 ms N/A
🆕 test_draw_rectangle[1024x1024-L] N/A 569.8 µs N/A
🆕 test_draw_rectangle[1024x1024-LA] N/A 3.7 ms N/A
🆕 test_draw_rectangle[1024x1024-RGB] N/A 3.7 ms N/A
🆕 test_draw_rectangle[1024x1024-RGBA] N/A 3.7 ms N/A

Comparing akx:faster-rect-and-line (0355c20) with main (ba06125)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.