Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance MetaDataEditor Lazy Loading of Gallery Thumbnails #5114

Conversation

thomaslow
Copy link
Collaborator

@thomaslow thomaslow commented Apr 29, 2022

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 the img-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.

@thomaslow thomaslow marked this pull request as draft May 4, 2022 12:39
…as well.

Without these changes chrome seems to freeze when the same image is dynamically changed from lazy to non-lazy when switching between gallery and preview view.
@thomaslow thomaslow marked this pull request as ready for review May 6, 2022 07:16
@Kathrin-Huber Kathrin-Huber merged commit d87f480 into kitodo:master May 13, 2022
@thomaslow thomaslow deleted the performance-metadataeditor-lazy-load-gallery-thumbnails branch May 19, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants