#106902filelist generates processedfile for drag and drop for every file upfront; bad performance
Description
Problem description
- introduced the feature that a small preview of the currently dragged file is shown next to the mouse cursor.
The URL to this preview is generated while the current file list is rendered. The URL is kept in the “data-filelist-thumbnail” attribute.
Unless a file is really dragged, this URL is never used, hence this processedfile is never generated.
During generation of the filelist the processedfile for the drag-operation is requested from FAL.
The database record for this processedfile is created and it is checked, whether it has been processed already.
Depending on this outcome, the URL for the file list is either the URL to the created preview file, or the endpoint for the actual file processing (/image/process; DeferredBackendImageProcessor).
The problem is, that checking whether the processedfile “is processed” already involves several calls to “->exists()” within FAL.
If the storage is not a local one, this causes expensive requests to the remote storage.
Tested on v12: For each file in the current folder three(!) file existence checks are run only for the drag-preview-image.
This is a significant slow-down of the editor’s experience.
Possible mitigations
Reconsider the way the preview-image URL is created/used. Instead of requesting the publicUrl of the processedfile upfront for every file, use an API call that issues a redirect to the publicUrl. So the processedFile handling is really deferred to the point, where the resource is really needed.
(drag operations are rare cases)
Improve FAL to reduce necessary I/O to a minimum. It is probably not necessary to query the filesystem 3 times whether a processedfile exists.
Instead of creating a dedicated drag preview image, take the one that is already in DOM for the list view.
If there is none, then use no image.
(also saves a lot of otherwise useless entries in the processed files table)
Reviews 10
- 13.4 91889[BUGFIX] Fix pixelated thumbnail FileInfo preview
- main 90255[BUGFIX] Fix pixelated thumbnail FileInfo preview
- 12.4 90194[BUGFIX] Handle oversights in thumbnail web component
- 13.4 90315[BUGFIX] Handle oversights in thumbnail web component
- main 90184[BUGFIX] Handle oversights in thumbnail web component
- 12.4 90142[BUGFIX] Offload decorative thumbnail generation in file list
- 13.4 90172[BUGFIX] Offload decorative thumbnail generation in file list
- main 90118[BUGFIX] Offload decorative thumbnail generation in file list
- 12.4 89836[BUGFIX] Remove dedicated processed file for DnD thumbnail
- main 89757[BUGFIX] Remove dedicated processed file for DnD thumbnail