Skip to content

fix: optimize file lookup for large folders - #3366

Open
arryndoestech wants to merge 1 commit into
nextcloud:masterfrom
arryndoestech:fix-large-folder-performance
Open

fix: optimize file lookup for large folders#3366
arryndoestech wants to merge 1 commit into
nextcloud:masterfrom
arryndoestech:fix-large-folder-performance

Conversation

@arryndoestech

@arryndoestech arryndoestech commented Sep 8, 2026

Copy link
Copy Markdown

Replaced the previous O(N^2) file lookup with one that:

  1. Builds the map of the files with the path
  2. Iterates over the sorted nodes and retrieves each file from the map

This turns the O(N^2) lookup into 2 O(N) operations Tested on a folder with about 10 000 files
this cuts down the time to finish enumerating fromabout 90 seconds to about 11 seconds
Also fixes the browser becoming unresponsive for that time

fixes: #3217 and #3015
I didn't see those before and didn't see that something was already in the works
You can choose to not merge it and wait for the changes mentioned in those issues

馃 AI (if applicable)

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

Replaced the previous O(N^2) file lookup with one that:
1. Builds the map of the files with the path
2. Iterates over the sorted nodes and retrieves each file from the map

This turns the O(N^2) lookup into 2 O(N) operations
Tested on a folder with about 10 000 files
this cuts down the time to finish enumerating fromabout 90 seconds to about 11 seconds
Also fixes the browser becoming unresponsive for that time

Signed-off-by: arryndoestech <178195651+arryndoestech@users.noreply.github.com>
@skjnldsv

skjnldsv commented Sep 8, 2026

Copy link
Copy Markdown
Member

/backport to stable35

@backportbot backportbot Bot added the backport-request Pending backport by the backport-bot label Sep 8, 2026
@skjnldsv

skjnldsv commented Sep 8, 2026

Copy link
Copy Markdown
Member

/backport to stable34

@skjnldsv

skjnldsv commented Sep 8, 2026

Copy link
Copy Markdown
Member

/backport to stable33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-request Pending backport by the backport-bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Viewer freezes the whole browser tab when opening a photo from a folder with thousands of images

2 participants