Skip to content

fix ajax timing calculation#35

Open
glaszig wants to merge 1 commit intopeek:masterfrom
glaszig:fix-timings
Open

fix ajax timing calculation#35
glaszig wants to merge 1 commit intopeek:masterfrom
glaszig:fix-timings

Conversation

@glaszig
Copy link

@glaszig glaszig commented Apr 26, 2024

ajax timings are derived from event.timeStamp values. latest browser improvements in anti-fingerprinting measures made APIs return timestamps with reduced time precision. calculating timings with those values with new Date().getTime() will blow up because it returns a different precision value. the solution is to use performance.now() in place of Date()

https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp https://developer.mozilla.org/en-US/docs/Web/API/Performance/now

should resolve #33
should resolve #25

possibly breaking change for older browsers. do we care about those?

ajax timings are derived from `event.timeStamp` values. latest browser improvements in anti-fingerprinting measures made APIs return timestamps with reduced time precision. calculating timings with those values with `new Date().getTime()` will blow up because it returns a different precision value. the solution is to use `performance.now()` in place of `Date()`

https://developer.mozilla.org/en-US/docs/Web/API/Event/timeStamp
https://developer.mozilla.org/en-US/docs/Web/API/DOMHighResTimeStamp
https://developer.mozilla.org/en-US/docs/Web/API/Performance/now

should resolve peek#33
should resolve peek#25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strange frontend time (Turbolinks?) Weird timing being shown in the performance bar on page navigation

1 participant