Project

General

Profile

Actions

Bug #104718

open

Filelist extremly slow having a lot of folders with subfolders on Rootlevel

Added by Nikolas Hagelstein 3 months ago. Updated 2 months ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Performance
Target version:
-
Start date:
2024-08-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Story

Loading the file tree takes ages on a storage which has many Folders on rootlevel (122 folder ins my Case) when the folders themselves are containing a lot of subfolders.
This might even lead to max_memory exceed errors or maximum_execution time exceed

Cause

The FileStorageTreeProvides determines the presence of subfolder in a very inefficent and redundant way. Due to recursive nature of the used fuction the performance impact is extremly high.

Solution

Step 1
To detect if a folder has a subfolder or not it is not neccessary to fetch all subfolder one is enought so change:
https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/backend/Classes/Tree/FileStorageTreeProvider.php#L64

 $hasSubfolders = !empty($folder->getSubfolders());


To:
 $hasSubfolders = !empty($folder->getSubfolders(0, 1));


Step 2
The prepareFolderInformation already holds the information if there is a subfolder or not. So no need to determine it again.

So remove this
https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/backend/Classes/Tree/FileStorageTreeProvider.php#L207

And referre to "prepareFolderInformation['hasChildren']" instead and reaad the check for InaccessibleFolder here:
https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/backend/Classes/Tree/FileStorageTreeProvider.php#L223

I applied the above changes to a my testystem and the loading time dropped from 30-55s to 2-3s.

Affected Systems:

  • Confirmed on TYPO3 11
  • Code looks the same in TYPO3 12 and 13 (only tested on v11)

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #100230: Improve performance of FileStorageTreeProviderClosed2023-03-20

Actions
Actions

Also available in: Atom PDF