Skip to content

perf: Improve preview cold generation - #65146

Open
CarlSchwan wants to merge 2 commits into
masterfrom
carl/preview-cold-generation
Open

CarlSchwan wants to merge 2 commits into
masterfrom
carl/preview-cold-generation

Conversation

@CarlSchwan

@CarlSchwan CarlSchwan commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Summary

1st commit: reuse the generated max preview image

2nd commit: Don't generate progressive image for the big preview as it is then expensive to encode and decode. (potentially controversial as the image takes then slightly more space and render less smoothly)

3rd commit: resize from the smallest suitable cached preview to avoid reading the max preview when possible

Save: with GD cold list view 8.2 → 13.6 req/s, grid 15.8 → 18.8

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@CarlSchwan CarlSchwan added this to the Nextcloud 36 milestone Oct 5, 2026
@CarlSchwan CarlSchwan self-assigned this Oct 5, 2026
@CarlSchwan
CarlSchwan requested a review from a team as a code owner October 5, 2026 14:59
@CarlSchwan
CarlSchwan requested review from Altahrim, icewind1991, provokateurin and sorbaugh and removed request for a team October 5, 2026 14:59
@CarlSchwan
CarlSchwan force-pushed the carl/preview-cold-generation branch from ac57633 to 9a33f6c Compare October 5, 2026 15:25
When the max preview was just generated, its image is still in memory.
Use it to resize the requested preview instead of reading the stored max
preview back and decoding it again, which for a 12 MP photo takes a
few hundred milliseconds.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
New preview sizes were always resized from the max preview, so each one
paid for decoding and resampling the full resolution image. Use the
smallest cached, uncropped preview that is still larger than the
requested size as the source instead, e.g. the 256px grid view preview
for the 64px list view one.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan
CarlSchwan force-pushed the carl/preview-cold-generation branch from 9a33f6c to 75b8b58 Compare October 5, 2026 17:46
@CarlSchwan
CarlSchwan added this pull request to stack #65162 October 6, 2026 07:38

This branch has not been deployed

No deployments
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