Beyond First Load Speed with INP

Rate this content
Bookmark

In this talk, we will go on a journey in the future of the core web vitals potential member INP, which will help in improving the interactions in all interactions in the session's lifetime, not only the first input delay as in the FID, showing some case studies and a way to optimize your website for INP, you will go away with a bunch of recommendations to do immediately

This talk has been presented at React Summit US 2023, check out the latest edition of this React Conference.

Watch video on a separate page

FAQ

IMP, or Interaction to Next Paint, is a new metric in Core Web Vitals designed to measure user interactions like taps, clicks, and key presses, capturing the time until the next screen update. This metric aims to provide a more comprehensive measurement of user experience than the existing First Input Delay (FID) by considering multiple interactions rather than just the first.

IMP was introduced to address limitations in the First Input Delay (FID) metric, which only measures the delay for the first user interaction and the time until the browser starts processing. IMP provides a more detailed insight into the user experience by measuring the delay for all interactions and their effect on the page's visual stability and responsiveness.

Besides IMP, Core Web Vitals includes Largest Contentful Paint (LCP), which measures the loading performance by tracking the time taken to render the largest content element visible in the viewport, and Cumulative Layout Shift (CLS), which measures the visual stability of a webpage to ensure there are no unexpected layout shifts during the page load.

IMP can be measured using real user monitoring tools like PageSpeed Insights and the Chrome User Experience Report. These tools allow developers to collect data based on actual user interactions with the website, providing accurate insights into the user experience metrics.

For an optimal user experience, the IMP metric should register under 200 milliseconds. Any value above 500 milliseconds is considered poor, indicating that interactions and updates are not occurring swiftly enough, potentially leading to user frustration.

To optimize for IMP, developers should avoid long tasks that block the main thread. Techniques like breaking down tasks into smaller chunks, using 'setTimeout' to yield control back to the main thread, or employing 'navigator.scheduling.isInputPending' to check for and respond to pending user inputs can significantly improve interaction responsiveness.

A common issue in user interaction metrics is 'rage clicks', where users repeatedly click on an unresponsive element due to delays in processing interactions. This can negatively impact the Interaction to Next Paint (IMP) metric, signaling a poor user experience.

Medhat Dawoud
Medhat Dawoud
8 min
15 Nov, 2023

Comments

Sign in or register to post your comment.
Video Summary and Transcription
The Talk discusses the Core of Vitals and IMP, which are metrics used to measure user experience in browsers. IMP measures multiple actions such as tab, click, and key press until the next screen updates. It also addresses the issue of rage clicks and their impact on user experience. The Talk emphasizes the importance of optimizing for IMB by avoiding blocking the main thread and suggests using multiple tasks and yield to main thread for optimization. Additionally, it mentions the use of navigatorScheduling.isInputPending to handle user input, with a caveat that support may vary across browsers.

1. Introduction to Core of Vitals and IMP

Short description:

Today, I'm going to talk about the Core of Vitals and why we needed IMP. So what IMP's measuring in the first place and how to optimize for IMP. Core of Vitals are a bunch of metrics that has been added to the browser in order to measure the user experience. The first one is LCP, or Largest Contentful Bind, to measure the time it takes until you load the first and biggest object in the screen above the fold. And the second one is CLS, or Commutatively Out Shift. It measures the visual stability for elements. And the third one is First Input Delay, or for short, it's FEDs. Some of them cannot be measured using synthetic testing, as I will explain in a bit. IMP is to measure multiple things, tab, click, key press until the next screen updates not only for the input delay and you can find this example for a frustrating experience. If you are clicking multiple times and one element, here's our friend is clicking twice in this menu to open it because the first one didn't really interact and unfortunately the second one closed the menu for them. So this is pretty frustrating and this action is called rage clicks and the more you have rich clicks, the less experience you have and the worst the interaction to an expense will be. IMB is now created and it can be measured already in the Pagespeed Insights under the other notable metrics. But early 2024 it will be moved up to the Curve of Vitals and will contribute to your ranking on Google search.

Hello, everyone. My name is Mithat Dawood. I'm a Senior Software Engineer working for Miro and a Google Developer Expert in web performance. Today, I'm very excited to take you on a journey for a new metric called IMP added to the Core of Vitals or would be for the Core of Vitals in early 2024. But this time, it is beyond the first load speech. So let's get started.

Today, I'm going to talk about four things. First of all, an introduction about the Core of Vitals and why we needed IMP. So what IMP's measuring in the first place and how to optimize for IMP. So without further ado, Core of Vitals are a bunch of metrics that has been added to the browser in order to measure the user experience. The first one is LCP, or Largest Contentful Bind, to measure the time it takes until you load the first and biggest object in the screen above the fold. And the second one is CLS, or Commutatively Out Shift. It measures the visual stability for elements. So you don't have any shifts happening in this page after loading the page. And the third one is First Input Delay, or for short, it's FEDs. And this is the most important one that we need to talk about today. So all of them can be measured easily using either field testing or Rome testing, as we call it, using something like Pagespeed Insights and Chrome User Experience Reports or lab testing, or also known as synthetic testing, using Lighthouse or Div tools. Some of them cannot be measured using synthetic testing, as I will explain in a bit.

So gaps we find in first input delay. It has some shortage. Google find out that first input delay only for the first interaction and only until the browser starts processing. This will be explained in a bit, but the most important thing is that most of the users are not interacting to the user until it is fully loaded. So 90% of the users are not really measuring for feds, which means that it's not really a good indicator that it is a good user experience or not. So the introduced interaction to an expense or for short, IMP. IMP is to measure multiple things, tab, click, key press until the next screen updates not only for the input delay and you can find this example for a frustrating experience. If you are clicking multiple times and one element, here's our friend is clicking twice in this menu to open it because the first one didn't really interact and unfortunately the second one closed the menu for them. So this is pretty frustrating and this action is called rage clicks and the more you have rich clicks, the less experience you have and the worst the interaction to an expense will be. And that's why the IMB is coming in the first place to enhance this and lower this experience as much as possible. IMB is now created and it can be measured already in the Pagespeed Insights under the other notable metrics. But early 2024 it will be moved up to the Curve of Vitals and will contribute to your ranking on Google search.

2. Measuring and Optimizing IMB

Short description:

IMB measures blocking tasks on the main thread, causing input delays. It includes input delay, processing time, and presentation delay. IMB should be under 200 milliseconds for good performance. To optimize for IMB, avoid blocking the main thread. Break down long tasks into separate functions and use yield to main thread to run them in different tasks.

This is measured in Pagespeed Insights or React, sorry, Chrome User Experience Report because it is requiring a real user to interact with it. However, you can measure something like TBT or Total Blogging Time in order to measure this FED or IMB. That is a good indication as well that you have a problem or not using synthetic testing.

So what does IMB is measuring? This is a normal task that you will find in any performance tab that is normal because it's under 50 milliseconds. However, in most cases, you will find a different task that is a blocking task. It's a long task, more than 50 milliseconds. Will be marked like this with a red strip. And this is called blocking task or blocking for the main thread. This means that any input is happening during this long task or blocking task will be delayed until the main thread is idle so they can interact with the user. And this is exactly the reason we have FED or IMB in the first place.

So for this example, if we have these blocking tasks in the beginning, if we consider this as the blocking tasks of loading the page. So this the first time it happens, the blocking task, but the user start interacting, this is FED. It's only measuring this part input delay until it started processing time. But IMB is measuring this full thing, input delay, processing time, presentation delay, and so on. So it's not only for the first input delay. And it's also for all the interaction for the user during the experience in your page. Not only the first one like FED. IMB based on research shows that it should be under 200 milliseconds in order to be considered as good, but anything above 500 milliseconds is considered poor or bad. you need to interact immediately.

So how to optimize for IMB? As a rule of thumb, don't block the main thread. This is the main problem that we are trying to fix here. So how to do that? Breaking down your long tasks. Here is a quick example of a function that is calling five different functions. So obviously this function is a long task, calling five different functions underneath it as you can see down there. So how to do that? How to fix it for IMB? Easily, we made a small change here. We just added all the functions in an array, loop over them and call them. But after calling each of them, we are making a small thing here. We are calling the yield to main thread. This is just a tweak, it's just a fallback like a workaround to yield to main thread using setTimeout. This means that each of these functions will run in a different task.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

A Guide to React Rendering Behavior
React Advanced 2022React Advanced 2022
25 min
A Guide to React Rendering Behavior
Top Content
This transcription provides a brief guide to React rendering behavior. It explains the process of rendering, comparing new and old elements, and the importance of pure rendering without side effects. It also covers topics such as batching and double rendering, optimizing rendering and using context and Redux in React. Overall, it offers valuable insights for developers looking to understand and optimize React rendering.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
React Concurrency, Explained
React Summit 2023React Summit 2023
23 min
React Concurrency, Explained
Top Content
Watch video: React Concurrency, Explained
React 18's concurrent rendering, specifically the useTransition hook, optimizes app performance by allowing non-urgent updates to be processed without freezing the UI. However, there are drawbacks such as longer processing time for non-urgent updates and increased CPU usage. The useTransition hook works similarly to throttling or bouncing, making it useful for addressing performance issues caused by multiple small components. Libraries like React Query may require the use of alternative APIs to handle urgent and non-urgent updates effectively.
The Future of Performance Tooling
JSNation 2022JSNation 2022
21 min
The Future of Performance Tooling
Top Content
Today's Talk discusses the future of performance tooling, focusing on user-centric, actionable, and contextual approaches. The introduction highlights Adi Osmani's expertise in performance tools and his passion for DevTools features. The Talk explores the integration of user flows into DevTools and Lighthouse, enabling performance measurement and optimization. It also showcases the import/export feature for user flows and the collaboration potential with Lighthouse. The Talk further delves into the use of flows with other tools like web page test and Cypress, offering cross-browser testing capabilities. The actionable aspect emphasizes the importance of metrics like Interaction to Next Paint and Total Blocking Time, as well as the improvements in Lighthouse and performance debugging tools. Lastly, the Talk emphasizes the iterative nature of performance improvement and the user-centric, actionable, and contextual future of performance tooling.
Optimizing HTML5 Games: 10 Years of Learnings
JS GameDev Summit 2022JS GameDev Summit 2022
33 min
Optimizing HTML5 Games: 10 Years of Learnings
Top Content
Watch video: Optimizing HTML5 Games: 10 Years of Learnings
PlayCanvas is an open-source game engine used by game developers worldwide. Optimization is crucial for HTML5 games, focusing on load times and frame rate. Texture and mesh optimization can significantly reduce download sizes. GLTF and GLB formats offer smaller file sizes and faster parsing times. Compressing game resources and using efficient file formats can improve load times. Framerate optimization and resolution scaling are important for better performance. Managing draw calls and using batching techniques can optimize performance. Browser DevTools, such as Chrome and Firefox, are useful for debugging and profiling. Detecting device performance and optimizing based on specific devices can improve game performance. Apple is making progress with WebGPU implementation. HTML5 games can be shipped to the App Store using Cordova.
How React Compiler Performs on Real Code
React Advanced 2024React Advanced 2024
31 min
How React Compiler Performs on Real Code
Top Content
I'm Nadia, a developer experienced in performance, re-renders, and React. The React team released the React compiler, which eliminates the need for memoization. The compiler optimizes code by automatically memoizing components, props, and hook dependencies. It shows promise in managing changing references and improving performance. Real app testing and synthetic examples have been used to evaluate its effectiveness. The impact on initial load performance is minimal, but further investigation is needed for interactions performance. The React query library simplifies data fetching and caching. The compiler has limitations and may not catch every re-render, especially with external libraries. Enabling the compiler can improve performance but manual memorization is still necessary for optimal results. There are risks of overreliance and messy code, but the compiler can be used file by file or folder by folder with thorough testing. Practice makes incredible cats. Thank you, Nadia!

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up
React Performance Debugging
React Advanced 2023React Advanced 2023
148 min
React Performance Debugging
Workshop
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
High-performance Next.js
React Summit 2022React Summit 2022
50 min
High-performance Next.js
Workshop
Michele Riva
Michele Riva
Next.js is a compelling framework that makes many tasks effortless by providing many out-of-the-box solutions. But as soon as our app needs to scale, it is essential to maintain high performance without compromising maintenance and server costs. In this workshop, we will see how to analyze Next.js performances, resources usage, how to scale it, and how to make the right decisions while writing the application architecture.
Maximize App Performance by Optimizing Web Fonts
Vue.js London 2023Vue.js London 2023
49 min
Maximize App Performance by Optimizing Web Fonts
WorkshopFree
Lazar Nikolov
Lazar Nikolov
You've just landed on a web page and you try to click a certain element, but just before you do, an ad loads on top of it and you end up clicking that thing instead.
That…that’s a layout shift. Everyone, developers and users alike, know that layout shifts are bad. And the later they happen, the more disruptive they are to users. In this workshop we're going to look into how web fonts cause layout shifts and explore a few strategies of loading web fonts without causing big layout shifts.
Table of Contents:What’s CLS and how it’s calculated?How fonts can cause CLS?Font loading strategies for minimizing CLSRecap and conclusion