Review main Abandoned

89213[POC][BUGFIX] Optimize directory listing of LocalDriver

Andreas Kienast CR 0 V 0 Normal +35 −37 updated 04/24/25, 09:49

Commit message

Building the item list of a directory in FAL's LocalDriver is somewhat
awkward:

* First, the whole content is retrieved via
  `retrieveFileAndFoldersInPath()` and applies a sorting to it
* Then, the generated list is iterated to filter items as per
  `$filterMethods`
* After that, the list is trimmed if `$start` and/or `$numberOfItems`
  are set

This patch reworks the directory listing to use generators instead to
avoid processing unneeded data, as filtering and limiting the results is
done in one loop.

Some smaller adjustents done in this patch:

* `FileStorageTreeProvider->prepareFolderInformation()` now limits the
  amount of subfolders to be fetched to 1 as this is enough to determine
  the existence of subfolders
* `LocalDriver->sortDirectoryEntries()` does not apply any sorting
  anymore if the amount of incoming items is less than 2

TODO:
* albeit generators have a worse runtime performance than working
  directly with a full directory iteration on a local storage on my
  machine, it may have performance gains when used with remote storages
  ** This needs to be checked **
* If this works out, it may solve #104718

Review

  • Code review CR 0
  • Verified V 0

Files 2

Review log 35

  1. Andreas Kienast uploaded patch set 1 04/24/25, 08:57

  2. Andreas Kienast uploaded patch set 2 04/24/25, 09:02

  3. core-ci voted on patch set 1 V -1 04/24/25, 09:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78105

  4. core-ci voted on patch set 2 V +1 04/24/25, 09:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/78106

  5. Andreas Kienast abandoned the change 04/24/25, 09:49

    This approach will lead to a different result, as limiting the result set is now done before sorting. Previously, the item list was sorted and then filtered / limited.