top of page

Google’s Experimental Feature Makes Webpages Faster

Google announced origin trials for a new feature available in Chrome right now that raises page speeds to new levels

Google announced a new way to run JavaScript that improves webpage responsiveness, helping publishers who use it to beat their competitors' performance in a new core web vital metric.

The announcement provides a sneak peek at a way to turbocharge webpage performance.

If this trial is successful then it may be something that publishers across all content management platforms and systems will want to use in order to get a jump ahead of their competitors.

The Problem Google Is Solving

Interaction to Next Paint (INP) is a metric that is a replacement for First Input Delay (FID).

INP is scheduled to go live as a Core Web vital metric on March 2024.

In order to score well on the coming soon INP core web vital, a webpage needs to be responsive to every possible user interaction.

One of the things that causes poor INP scores is some JavaScript take a long time to run.

When these scripts take a long time to run, they are called Long Tasks.

The problem with Long Tasks is that they’re like a slow driver on a road that is poking along in the fast lane, slowing down traffic.

What currently happens is that the scripts that control user interaction are blocked by the long task, causing the webpage to be unresponsive.

The user in that scenario waits and waits for the page to do something after clicking a button.

What typically occurs in many webpages today is that a user interaction has to wait until the long task finishes running.

The image below shows how a long task blocks the important user interaction task from running. What Google is proposing is a solution to that problem that makes the long task behave like a slow car that pulls over to the side of the road to allow a fire truck go by.

Existing Strategies Don’t Work

There are already coding workarounds that help improve user interaction scores.

But they don’t really work well because they were designed to solve other problems, not the user interaction problem.

Google’s explainer says that existing strategies pause the long task but send it to the back of the queue of all the other scripts, many of which may not be as important as the long task.

In that typical scenario, the long task that must be finished has to wait until less important scripts finish because it’s at the back of the line now.

Current coding workarounds can end up creating a worse situation instead of helping.


Solution For Long Tasks is scheduler.

yield

The solution to the long task problem is an approach that Google calls scheduler.yield.

What scheduler.yield does is to pause the long task in order to yield to the user interaction task, which can start running.

Once the user interaction script is finished the long task is able to jump to the head of the queue and start running again.

Here’s an illustration published by Google that shows how a long task can be broken into smaller tasks in order to allow important user interaction scripts to run.




bottom of page