Created
Apr 22, 2023 4:34 PM
I was looking at some performance metrics around file upload the other day and noticed some really large outliers. It was being reported that some operations were taking over 20 hours! After digging through some of the data, I noticed that the there were several data points at 20 hours, and they were all coming from the same user.
This was suspicious to me – as if all operations had halted on the users computer and restarted at around the same time. One possible explanation was that the computer fell asleep, so the CPU halted, and upon restart, the CPU restarted and finished the operation. We were using performance.now()
to measure how long operations took, and I expected it to measure CPU time (since DateTime
measures Unix time).
Turns out that is not the case! According to the docs, performance.now()
measures “time elapsed since Performance.timeOrigin
which is the time when navigation has started in window contexts.” There’s a specific call out in t