Skip to content

Integrate Embed Optimizer with Optimization Detective to skip lazy-loading LCP embeds #1054

Description

@westonruter

Feature Description

The Embed Optimizer (#888) plugin improves performance for the majority of embeds by lazy-loading them so they don't impede page loading when not in the viewport. However, if they are in the initial viewport the lazy-loading will actually hurt performance by potentially delaying LCP. Any embeds which do not appear in the initial viewport should be excluded from lazy-loading. This can't be done reliably server-side, for example core uses a counter to skip lazy-loading the first N instances. However, Optimization Detective (#869) is built to be able to detect which elements are in the initial viewport so that they can be properly optimized. What is needed is for Optimization Detective to expose an interface for other plugins to hook into the optimization process so that, in the case of Embed Optimizer, it can actually reverse the lazy-loading which it blindly applied server-side for the in-viewport embeds.

Alternatively, the server-side logic for Embed Optimizer could be modified when Optimization Detective is also running to not immediately make the embeds lazy-loaded, but rather to instead mark the embeds with an attribute for the lazy-loading to be applied during post-processing, that is, on the output-buffered page which the HTML Tag Processor iterates over.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Plugin] Embed OptimizerIssues for the Embed Optimizer plugin (formerly Auto Sizes)[Plugin] Optimization DetectiveIssues for the Optimization Detective plugin[Type] EnhancementA suggestion for improvement of an existing feature

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions