Understanding page load and loadEventEnd

What is PerformanceNavigationTiming: loadEventEnd and how it compares to LCP

Updated over a week ago

The PerformanceNavigationTiming interface provides detailed timing metrics that help web developers understand the performance of their web pages. Among its various properties, loadEventEnd stands out as a key indicator of when the load event finishes processing.

Alongside real user experience (CrUX) indicators, NitroPack leverages various technical metrics to assess page load times, with loadEventEnd being a prime example. This discussion will focus on PerformanceNavigationTiming: loadEventEnd, detailing its functionality, its comparison to the Largest Contentful Paint (LCP) metric, and situations where it may yield unusually divergent values.


What is loadEventEnd?

loadEventEnd is a property of the PerformanceNavigationTiming interface that marks the time when the load event of the current document is completed. This includes the time when the browser has finished loading the page's resources and has processed the load event. The value is given in milliseconds since the same origin's time origin, which is typically the time when the user navigated to the page.

How loadEventEnd Differs from LCP

Largest Contentful Paint (LCP) is a performance metric that measures when the largest content element in the viewport becomes visible to the user. It is part of the Core Web Vitals, a set of metrics that focus on user experience. Here are key differences between loadEventEnd and LCP:

Nature of Measurement: LCP measures the rendering speed of the largest content element, such as an image or text block, which is crucial for user experience. In contrast, loadEventEnd measures the overall time taken for the page to fully load, including the processing of the load event.

User Experience Focus: LCP is directly related to what users see on their screen, making it a more direct measure of perceived performance. loadEventEnd encompasses a broader range of activities, many of which may not directly impact the user's perception of speed.

Timing: LCP can occur before or after loadEventEnd. If the largest content element is rendered quickly, LCP may happen well before the load event completes. Conversely, if there are delays in rendering large elements, LCP could occur after loadEventEnd.

There are several scenarios where loadEventEnd might report a significantly different number of seconds compared to LCP, even if the page appears to load quickly:

Heavy Use of External Resources: Pages that rely heavily on external scripts, stylesheets, or other resources can experience delays in completing the load event, as each resource needs to be fetched, executed, or rendered.

Background Processes: JavaScript that runs in the background (e.g., for tracking, animations, or deferred content loading) can extend the duration until the load event is considered complete.

Unoptimized Third-Party Scripts: Third-party scripts for ads, analytics, or widgets can significantly impact load times, especially if they are not optimized for performance.

Understanding the nuances of loadEventEnd and how it compares to user-centric metrics like LCP is crucial for web performance optimization. While loadEventEnd provides valuable insights into the overall loading process, it's important to consider it alongside other metrics to get a comprehensive view of your site's performance. For example, in cases where loadEventEnd reports higher values than expected, investigating the specific causes can lead to targeted optimizations that enhance both the perceived and actual performance of your web pages.

Did this answer your question?