Fix ImageChops.offset for 16-bit modes + speed up - #9975
Merged
Conversation
Merging this PR will improve performance by ×2.8
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | test_offset[1237x811-L] |
11 ms | 1.9 ms | ×5.7 |
| ⚡ | test_offset[1237x811-LA] |
16.7 ms | 7.4 ms | ×2.3 |
| ⚡ | test_offset[1237x811-RGB] |
16.7 ms | 7.4 ms | ×2.3 |
| ⚡ | test_offset[1237x811-RGBA] |
16.7 ms | 7.4 ms | ×2.3 |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing akx:offset-16-fix (ed627f5) with main (3c7080c)
Footnotes
-
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
marked this pull request as ready for review
September 9, 2026 11:36
hugovk
approved these changes
Sep 9, 2026
radarhere
reviewed
Sep 10, 2026
akx
marked this pull request as draft
September 10, 2026 09:13
Contributor
Author
|
Oh, I realized there's a much better way to do this still, roundaboutly via @radarhere's suggestion PR... |
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
akx
marked this pull request as ready for review
September 10, 2026 10:38
Contributor
Author
-Merging this PR will improve performance by 16.37%
+Merging this PR will improve performance by ×2.8There we go... 😄 |
radarhere
reviewed
Sep 10, 2026
radarhere
approved these changes
Sep 10, 2026
radarhere
reviewed
Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows up on #9753 (via @hugovk's excellent catch #9753 (review)).
This replaces the whole internal implementation of
ImageChops.offsetwith a much simplermemcpy()pattern rather than computing modulos for every pixel...