Skip to content

Apply hoist optimizations to Geometry.c's transforms#9788

Draft
akx wants to merge 1 commit into
python-pillow:mainfrom
akx:faster-geometry-1
Draft

Apply hoist optimizations to Geometry.c's transforms#9788
akx wants to merge 1 commit into
python-pillow:mainfrom
akx:faster-geometry-1

Conversation

@akx

@akx akx commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Like the other recent optimization PRs: hoist im*->xsize and im*->ysize into locals so autovectorization can do its thing.

@codspeed-hq

codspeed-hq Bot commented Jul 10, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.41%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 13 improved benchmarks
✅ 332 untouched benchmarks
⏩ 2 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
test_rotate_right[1024x1024-L-ROTATE_180] 4.5 ms 3.6 ms +24.06%
test_rotate_right[1024x1024-L-FLIP_LEFT_RIGHT] 4.5 ms 3.6 ms +24.05%
test_rotate_right[1024x1024-RGBA-ROTATE_180] 7.4 ms 6.5 ms +13.44%
test_rotate_right[1024x1024-LA-ROTATE_180] 7.4 ms 6.5 ms +13.44%
test_rotate_right[1024x1024-RGB-ROTATE_180] 7.4 ms 6.5 ms +13.44%
test_rotate_right[1024x1024-RGBA-FLIP_LEFT_RIGHT] 7.4 ms 6.5 ms +13.44%
test_rotate_right[1024x1024-LA-FLIP_LEFT_RIGHT] 7.4 ms 6.5 ms +13.43%
test_rotate_right[1024x1024-RGB-FLIP_LEFT_RIGHT] 7.4 ms 6.5 ms +13.42%
test_scale[1024x1024-LA-2.14-NEAREST] 37.5 ms 33.5 ms +11.96%
test_scale[1024x1024-RGBA-2.14-NEAREST] 37.5 ms 33.5 ms +11.91%
test_scale[1024x1024-F-2.14-NEAREST] 37.5 ms 33.5 ms +11.91%
test_scale[1024x1024-I-2.14-NEAREST] 37.5 ms 33.5 ms +11.9%
test_scale[1024x1024-RGB-2.14-NEAREST] 37.5 ms 33.5 ms +11.89%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing akx:faster-geometry-1 (ffd82f2) with main (b39b964)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants