Now, who here has worked with this metric before? Has anyone tried debugging or optimizing it? Actually, I can't see anything from here because of the lights. Well, all right, let's take a really quick dive into a theory.
So, the core idea behind this new metric is that it tells you how slow your app is. And when you see an interaction to next point of, for example, 393 milliseconds, here's how it's calculated. First, when you open any app or website on your Chrome, Chrome measures every click or keypress that you do on the page and finds the slowest one of them. Then, Chrome takes that slowest value and sends it to Google servers saying, hey, for this session the INP value was, for example, 500 milliseconds, which means the slowest click or keypress on the page was 500 milliseconds. And then, as more users visit the page and do the clicks and send their INP values, Google does the statistics magic and computes the overall INP for all the visits. So, that's what INP is. End of theory.
Let's see how it looks in practice. So, here is a very basic note-taking app. You could open a note, you could type into a note, it supports markdown, you could create a new note and you could also filter notes. And the filter not action, it's pretty slow. So, here in this corner, you could see this spinning bar, which is a spinner, which shows when the app is responsive. So, when the spinner spins, that means the app is responsive. When the spinner freezes, that means the app is also frozen. And if I try to type into this filter input, you could see that the moment I type, the spinner freezes for half a second or a second. This means typing into the filter is very unresponsive, I can feel that, and the page holds freezes for that period of time. So, that is about user experience. And this also worsens the interaction to an expanded metric.
Now, there's a very easy way, there's a very simple way to see how exactly the interaction to an expanded metric is affected by this. To see this, I'm going to go to the Chrome web store, I'm going to find the web vitals extension, I'm going to install it into Chrome. I'm going to open its options, enable console login, and then open the console on my page. And now, if I reload the page, and if I look into the console, I would see every core vital, every performance metric of the page of the app logged into the console. And if I try to interact with the app, like, for example, selecting some text, right, or just clicking some random places on the page or opening notes, I would see how long any interaction on the page I took. I mean, took. And if I try typing into the filter input, I would see that typing into the filter input is very, very slow. The interaction takes 500, 600 milliseconds and that results in a red INP. And you can also see how the more I interact with the page and the worse the interaction time gets, the higher the INP value also gets. Like INP is just the slowest interaction that's happened on the page, right? So you could see that every time I make an interaction that gets even slower than it was before, the NP value also goes up.
Comments