Issue Task Resolved

#109411Load multiple image variants at once

Ayke Halder 03/27/26, 18:15 updated 07/15/26, 14:45

Description

Load multiple variants of the same image at once to improve performance and load on db.

With html picture source-sets there are lots of variants (like `200w, 400w, 600w, 800w, 1000w, 1200w`) of the same image which needs to be loaded at once.

A real page showing a list of news-articles might have like
  • 35 pictures in total (25 for the news-list plus 10 extra)
  • two source-sets of 10 images per picture (one for density 1x and one for 2x)

—> This currently results in 700 pictures and 700 SQL queries, which could be reduced to 70 SQL queries.

——

E.g. a page – showing 3 pictures in 6 variants only – needs already 18 queries to get the images from sys_file_processedfile:

Current – first load with image creation

_.SQL Query _.Count _.Total Time [ms]
Total 49 30.83
SELECT * FROM `sys_file_processedfile` WHERE (`original` = ?) AND (`task_type` = ?) AND (`configurationsha1` = ?) 18 13.03
INSERT INTO `sys_file_processedfile` (`width`, `height`, `checksum`, `name`, `identifier`, `storage`, `configuration`, `task_type`, `configurationsha1`, `original`, `originalfilesha1`, `crdate`, `tstamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 18 10.99

Current – clear cache reload

_.SQL Query _.Count _.Total Time [ms]
Total 31 14.94
SELECT * FROM `sys_file_processedfile` WHERE (`original` = ?) AND (`task_type` = ?) AND (`configurationsha1` = ?) 18 8.00

——

With the optimized implementation the same page needs 3 queries only to get the images from sys_file_processedfile:

New – first load with image creation

_.SQL Query _.Count _.Total Time [ms]
Total 34 22.00
INSERT INTO `sys_file_processedfile` (`width`, `height`, `checksum`, `name`, `identifier`, `storage`, `configuration`, `task_type`, `configurationsha1`, `original`, `originalfilesha1`, `crdate`, `tstamp`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 18 10.99
SELECT * FROM `sys_file_processedfile` WHERE (`original` = ?) AND (`task_type` = ?) AND (`configurationsha1` IN (?, ?, ?, ?, ?, ?)) 3 2.99
… … …

New – clear cache reload

_.SQL Query _.Count _.Total Time [ms]
Total 16 9.99
SELECT * FROM `sys_file_processedfile` WHERE (`original` = ?) AND (`task_type` = ?) AND (`configurationsha1` IN (?, ?, ?, ?, ?, ?)) 3 1.84
… … …

Reviews 3

History 210

  1. Ayke Halder commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-07-15T14:45:09+00:00" > 07/15/26, 14:45 </span>

    Applied in changeset commit:32a729defc51a72cc935440dbb3ac7e7182f3473.