Hi all! Recently I noticed that duration of function
history.pushState() varies from website to website. I measured the time it takes to execute that function like this. const measurePushState = () => {
const start = performance.now();
history.pushState( { key: 'abc123' }, null, '/some-path');
const end = performance.now();
console.log(end - start, 'ms');
}
I tried to run that measurement code on many websites, among them Facebook and AirBnb. The duration was in most cases up to 3 ms. On a website that I am developing, it takes around 60 - 80 ms. We use client site routing, which uses history.pushState behind the scenes at this website. On some slower devices it takes up to 400 ms which produces a slight delay when navigating on the client side. Therefore I was wandering if someone would have an answer for this question:
What could have an impact on duration of the function history.pushState()?
Thanks,
Jakub