Unlock Browser Speed: Measure Page Load Times with HTML5 Performance Timing API
This article explains how the HTML5 Performance Timing API records timestamps for each stage of page navigation, shows how to compute metrics such as DNS lookup, TCP connection, request, DOM parsing, and total load time, and provides sample JavaScript code from a GitHub repository.
The HTML5 Performance Timing API records timestamps for each step from unloading the current page to the complete loading of the target page, allowing developers to calculate detailed performance metrics.
Key timing calculations
Preparation of new page: timing.fetchStart - timing.navigationStart Redirect duration: timing.redirectEnd - timing.redirectStart AppCache duration: timing.domainLookupStart - timing.fetchStart Unload of previous page: timing.unloadEventEnd - timing.unloadEventStart DNS lookup time: timing.domainLookupEnd - timing.domainLookupStart TCP connection time: timing.connectEnd - timing.connectStart Request time: timing.responseEnd - timing.requestStart Time from request completion to DOM interactive: timing.domInteractive - timing.responseEnd DOM parsing time: timing.domComplete - timing.domInteractive Load event time: timing.loadEventEnd - timing.loadEventStart Total time from navigation start to load: timing.loadEventEnd - timing.navigationStart A useful JavaScript implementation that computes these values is available on GitHub at https://github.com/CraryPrimitiveMan/performance-tool.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
