Overview
The User Timing API provides a standardized way to measure how long specific JavaScript tasks or application events take. It allows developers to create custom 'marks' and 'measures' that appear in browser dev tools and can be collected for analysis.
Key Methods
performance.mark(): Creates a timestamp with a given name.performance.measure(): Calculates the duration between two marks.performance.clearMarks()/performance.clearMeasures(): Cleans up the performance buffer.
Benefits
Unlike Date.now(), the User Timing API uses a high-resolution timer (sub-millisecond precision) and integrates directly with browser performance profiling tools.