Skip to content

Speed up Image.point() and Image.point_transform()#9743

Open
akx wants to merge 3 commits into
python-pillow:mainfrom
akx:faster-point
Open

Speed up Image.point() and Image.point_transform()#9743
akx wants to merge 3 commits into
python-pillow:mainfrom
akx:faster-point

Conversation

@akx

@akx akx commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Refs #9649, #9675, #9736, #9737, #9738, #9739, #9740 (same series, same techniques).

Cf. the aforementioned PRs, this also does a couple other cleanups for performance; on my machine, using ImagingNewDirty gave another +10% on top of the first commit. The last commit would technically allow a compiler to inline the point functions, but given their size, a compiler probably won't.

@akx akx changed the title Speed up Image.point() Speed up Image.point() and Image.point_transform() Jun 30, 2026
@codspeed-hq

codspeed-hq Bot commented Jun 30, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 35.95%

⚠️ 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

⚡ 6 improved benchmarks
✅ 325 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
test_point_transform[1024x1024-I] 10.1 ms 5.2 ms +93.63%
test_point_transform[1024x1024-F] 7.6 ms 5.2 ms +46.96%
test_point_lut[1024x1024-L] 4.9 ms 3.7 ms +31.84%
test_point_lut[1024x1024-RGBA] 15.1 ms 12.3 ms +22.04%
test_point_lut[1024x1024-RGB] 13.3 ms 11.1 ms +19.2%
test_point_lut[1024x1024-LA] 11.4 ms 9.9 ms +15.67%

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-point (81444fe) with main (6590b1b)

Open in CodSpeed

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