9/20/2023 0 Comments First input delayThere's an old(-ish) article about using an 'Idle until urgent' pattern for JavaScript execution whereby you ask the browser to schedule something computationally expensive for when it has spare resources, but you reserve the right to jump it right to the top of priority queue when the visitor suddenly starts interacting with it. However, that's not always the best use of resources. This might require re-working that computationally expensive thing to use the event loop, or do it lazily when it's required. Usually, the answer here is to split the JavaScript up into smaller files and/or give the browser chance to interrupt the execution. That's going to take a decent amount of time, and while the browser is doing that your site visitors are getting frustrated when pressing the 'buy now' button and nothing is happening. If you have particularly large JavaScript files or code that takes a long time to execute, then you'll want to look at breaking those elements up and at least giving the browser a chance to run other code, as that's what First Input Delay measures.įor example, say you have a massive JavaScript file of all the code for your massive application and you load it up on page load and get the browser to parse and evaluate it. The likely culprit for a long First Input Delay is, of course, JavaScript. I've highlighted (green arrows) where Chrome has highlighted (blue shading) a 'Long task', these are the places to start looking if you want to reduce your FID since they are periods where if a visitor tries to interact with your site they may not get any kind of feedback from your site for a significant period of time.Īs for what those tasks are, you'll have to investigate on a case-by-case basis and take appropriate action. I've used this against our very own turning off network caching, enabling throttling of the network and CPU and then I get a trace that looks like this: You can look up your site's First Input Delay using Google's page speed insights tool easily: īut if you want to get a sense of what might be causing an issue with high First Input Delay then you can use Chrome's performance tool built into the Inspector. If your site isn't high traffic enough, it may not even have a score. Google uses actual performance data from actual visitors to your site to compute this score. The crucial thing to understand though is that it's not something you can measure with a computer. There are many great articles explaining what First Input Delay is, so go read them if you need to, and then come back here! Usually, we aim for more traffic, not less :) First input delay If you don't pay attention to this metric then you may find Google lowering your site in their rankings and thus you get less and less traffic to your site. If your website gets a lot of traffic from search engines, and Google in particular, then you need to care about all the things that Google wants you to care about, including 'First input delay'.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |