author avatar

ashwanikumarjha

Tue Jun 25 2024

Performance API

Seems super useful for tracking web performance, it let us measure various performance metrics of web pages, like how long specific operations take.

1. performance.now()
◦ Provides the current time in milliseconds with high precision, can be useful for measuring how long specific tasks take.
2. PerformanceEntry
◦ Object representing a metric. It includes:
▪︎ navigation: Information about page loads.
▪︎ resource: Data on loaded resources like scripts and images.
▪︎ mark: User-defined timestamps.
▪︎ measure: Duration between two marks.
3. PerformanceNavigationTiming
◦ Specific type of PerformanceEntry for page navigation metrics.
◦ Tells us if a page load is due to a navigation, reload, or history action.
◦ eg properties: domComplete, domContentLoadedEventEnd, type.
Probable use Cases:
• Can help us analyze how long different parts of the page load take.
• Can help us check how long it takes to load each resource.
• Can help us determine if a page is reloaded or newly navigated.
#performance #browser