Skip to content

Resize between TypedImages, to compile each convolution once - #18

Closed
bgw wants to merge 1 commit into
mainfrom
bgw/resize-typed-image
Closed

bgw wants to merge 1 commit into
mainfrom
bgw/resize-typed-image

Conversation

@bgw

@bgw bgw commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

fast_image_resize's intermediate buffers (the premultiplied source, and
the result of the first pass) are TypedImages, but a DynamicImage
source becomes a TypedImageRef, so every horizontal and vertical
convolution was compiled for both. Wrapping our buffers as TypedImages
leaves one copy: the release worker shrinks from 5,389,384 to 5,192,776
bytes on aarch64-unknown-linux-gnu (-192 KiB, -3.6%). The kernels are
the same, so it shouldn't change performance.

This also drops fast_image_resize's image feature, which was only for
DynamicImage's IntoImageView impl.

Co-Authored-By: Claude noreply@anthropic.com


Stack created with GitHub Stacks CLI • Give Feedback 💬

fast_image_resize's intermediate buffers (the premultiplied source, and
the result of the first pass) are `TypedImage`s, but a `DynamicImage`
source becomes a `TypedImageRef`, so every horizontal and vertical
convolution was compiled for both. Wrapping our buffers as `TypedImage`s
leaves one copy: the release worker shrinks from 5,389,384 to 5,192,776
bytes on aarch64-unknown-linux-gnu (-192 KiB, -3.6%). The kernels are
the same, so it shouldn't change performance.

This also drops fast_image_resize's `image` feature, which was only for
`DynamicImage`'s `IntoImageView` impl.

Co-Authored-By: Claude <noreply@anthropic.com>
@bgw
bgw added this pull request to stack #21 November 19, 2026 17:04
@bgw

bgw commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

IMO this gets us the majority of the size win and is a better approach: #22

@bgw bgw closed this Nov 20, 2026
@bgw
bgw removed this pull request from stack #21 November 20, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant