Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance Measure with multiple marks of same name

I'm currently setting a custom mark on each page transition by running window.performance.mark('transition-start'). Afterwards when an above-the-fold portion of the page is interactive, I create another mark, window.performance.mark('transition-end'). When the user performs multiple page transitions in this single page application, multiple marks of the 'transition-start' and 'transition-end' occur.

When using window.performance.measure('transition', 'transition-start', transition-end'), can I be sure that the latest marks will always be used, considering multiple marks of the same name exist? I've tested this in Firefox and Chrome and see the latest marks used, but I can't find documentation on this use case.

like image 714
Joseph Avatar asked Jan 26 '26 12:01

Joseph


1 Answers

It's been stated in the User Timing API spec, that:

if mark is a DOMString, let end time be the value of the startTime attribute from the most recent occurrence of a PerformanceMark object in the performance entry buffer whose name is mark. If no matching entry is found, throw a SyntaxError.

Measure takes the Most Recent marks into consideration, when calculating the duration timestamp.

Details can be read in the following Docs:

  • Measure API
  • Convert a Mark to Timestamp
like image 143
phoenisx Avatar answered Jan 29 '26 02:01

phoenisx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!