Repository navigation
Reduce CPU and memory usage - #490
Merged
Merged
Conversation
That way we can make use of the cached internal path on the node and don't have to look it up again.
Space root paths don't change, so we can keep a list in memory and spare a lot of id cache lookups.
In cases like dir listings we already know the internal path of the node and don't have to retrieve it from the id cache again.
This tremendously reduces the load on the system when directories are being skipped, e.g. when reindexing a space. Without this change all directories in the space root were listed, even if only one of them or one file needed to be scanned.
rhafer
approved these changes
Jan 13, 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.
This PR improves and extends internal caches to reduce the number of ID cache lookups needed. For directory listings the number of lookups was reduced from 3 lookups per item in the directory to 0.
It also changes the walker to not list directories that are being skipped anymore.
Depending on the space layout the reduction of CPU and memory usage when reindexing a space can be substantial:
Before:

After:

Fixes opencloud-eu/opencloud#2055
Fixes opencloud-eu/opencloud#2128