📜 ⬆️ ⬇️

Reactive prefetch: Google’s mobile search has become 100-150 ms faster



Google search from a mobile browser is now faster, and specifically, at 100-150 milliseconds. This was made possible by the introduction of a new function called reactive prefetching . In English, it sounds much shorter: reactive prefetch.

When you click on one of the links in the search results, the browser starts to load the page. And here is one trick, explains Ilya Grigorik from Google: at the same time, the browser receives instructions on which critical resources should be downloaded in parallel threads when requesting a web page. Such parallel loading greatly accelerates the overall rendering time of the page.

What is important, this method does not increase traffic at all. There is no pre-caching of resources. Downloading begins only after a person has clicked on the link. And in parallel streams, it gets what it would later load.
')
By the way, website owners can use a similar method for links on their websites to speed up the loading and rendering of pages.

On your website, you can make it much easier and more efficient, because we can accurately find out the list of critical resources that are loaded into the browser last and slow down rendering. But Google engineers automated the procedure by applying all sly tricks.

First, they have compiled a list of critical resources for all pages on the web! This alone is worth a lot. Just imagine, you need to analyze the rendering of each page in a mobile browser. Presumably, thousands of virtual machines loaded pages and recorded logs, which were then processed separately.

Secondly, in order to transfer the command for reactive prefetch to the browser, this function should be implemented in the API. This works through a dynamic webpage change. The corresponding code is inserted into the page immediately after the user has clicked on the link.

In the end, the browser must be able to download resources in parallel streams.

Currently, reactive prefetch is activated only for Chrome users on Android. This is the only browser that supports the dynamic injection of prefetch code into a web page and reliably handles prefetch requests.

Source: https://habr.com/ru/post/364173/


All Articles