Skip to content

Speed up some conversions - #9807

Open
akx wants to merge 4 commits into
python-pillow:mainfrom
akx:faster-convert-x
Open

Speed up some conversions#9807
akx wants to merge 4 commits into
python-pillow:mainfrom
akx:faster-convert-x

Conversation

@akx

@akx akx commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Experiments to speed up the other conversions didn't really yield fruit.

@akx
akx marked this pull request as ready for review July 21, 2026 09:03
Comment thread Tests/benchmarks.py Outdated
@akx
akx requested a review from radarhere July 29, 2026 05:37
@akx akx mentioned this pull request Jul 29, 2026
@hugovk

hugovk commented Aug 9, 2026

Copy link
Copy Markdown
Member

Rebased following benchmark image update: #9831.

Edit: or not, due to conflict :)

Merging main in instead.

@codspeed-hq

codspeed-hq Bot commented Aug 9, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 71.2%

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

⚡ 4 improved benchmarks
✅ 551 untouched benchmarks
⏩ 335 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
test_convert[1237x811-P-RGBA] 9.9 ms 4.9 ms ×2
test_convert[1237x811-P-RGB] 9.3 ms 5.1 ms +81.24%
test_convert[1237x811-PA-RGB] 10.7 ms 6.5 ms +64.05%
test_convert[1237x811-PA-RGBA] 11.3 ms 7.9 ms +42.27%

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-convert-x (b7e834c) with main (c8c74c8)

Open in CodSpeed

Footnotes

  1. 335 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.

@akx
akx force-pushed the faster-convert-x branch from ca525b3 to b7e834c Compare August 10, 2026 18:23
Comment thread src/libImaging/Convert.c
"conversion from %.10s to %.10s not supported",
return (Imaging)PyErr_Format(
PyExc_ValueError,
"conversion from %s to %s not supported",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"conversion from %s to %s not supported",
"conversion from %.10s to %.10s not supported",

This has the inadvertent change that was initially in #9863

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get #9863 (double approved, CI green) merged so I can just rebase this on top of main?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just waiting to see if you had any thoughts on my final attempt to reformat the switch - akx#12

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@radarhere merged akx#10 instead, so waiting for the merge on #9863 to rebase this and get rid of this commit altogether here 👍

Comment thread src/libImaging/Convert.c
"conversion from %.10s to %.10s not supported in convert_transparent",
return (Imaging)PyErr_Format(
PyExc_ValueError,
"conversion from %s to %s not supported in convert_transparent",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"conversion from %s to %s not supported in convert_transparent",
"conversion from %.10s to %.10s not supported in convert_transparent",

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.

3 participants