Skip to content

perf: Improve preview cold generation - #65146

Merged
CarlSchwan merged 2 commits into
masterfrom
carl/preview-cold-generation
Oct 13, 2026
Merged

CarlSchwan merged 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: 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 2 times, most recently from 9a33f6c to 75b8b58 Compare October 5, 2026 17:46
@CarlSchwan
CarlSchwan added this pull request to stack #65162 October 6, 2026 07:38
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 75b8b58 to b204f1e Compare October 12, 2026 14:53
@CarlSchwan

Copy link
Copy Markdown
Member Author

/backport to stable35

@CarlSchwan
CarlSchwan merged commit c64e6b4 into master Oct 13, 2026
168 checks passed
@CarlSchwan
CarlSchwan deleted the carl/preview-cold-generation branch October 13, 2026 07:57
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