Performance MetaDataEditor Lazy Loading of Gallery Thumbnails #5114
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.
Related Issues:
When navigating to the meta data editor, all gallery thumbnails are loaded right at the start of the page load, even though - for large galleries - most thumbnails are not visible at the start.
This pull request adds the property
loading="lazy"
to all thumbnails, which is a standard attribute for theimg
-tag supported by most modern browsers (edge, firefox, chrome, opera, safari) except some mobile browsers.Advantages
The number of HTTP requests when loading a meta data editor with 1000 pages is reduced significantly, e.g., from 1044 requests to 104 requests. Depending on the network performance, this can reduce loading times significantly. For high performance networks (wired local area networks) the loading time is reduced only slightly from 5.79 seconds to 5.67 seconds (desktop workstation) or 20.81 seconds to 17.43 seconds (laptop).
Together with the following other pull requests
the loading time is reduced from 5.79 seconds to 2.27 seconds (desktop workstation) or 20.81 seconds to 6.01 seconds (laptop).
Disadvantages
When scrolling the gallery, thumbnails are not yet available and will be loaded during scrolling. Meaning, there will be a slight delay before thumbnails are visible.
simplescreenrecorder-2022-04-29_12.40.53.mp4
Update 2022-05-04: For large galleries (e.g. 2000 images), when switching between gallery view and preview view, Chrome freezed because the same image thumbnail was dynamically changed from lazy to non-lazy because not all img-tags had been marked lazy in gallery.xhtml, see 32d21d6 .
Update 2022-05-06: Seems to work fine now, no further problems detected.