Computer

Improved cookie management: Chrome loads pages faster

Improved cookie management: Chrome loads pages faster

Un browser come Chrome constantly sends telemetry data to Google which allows it to constantly probe the quality of the user experience when visiting any web page. This information is used from a Core Web Vitals perspective, to understand which pages offer thebrowsing experience better and which ones make it more complex. The rating is composed by aggregating data from the entire user base. The Google team explains that this information is however used for improve the performance of Chrome itself. There cookie management it is, for example, a crucial aspect, which in some cases – especially in the case of poorly developed web pages – can literally undermine performance.

I cookie they are small text files that have become an integral part of many web pages since time immemorial. They are used to store information such as user preferences and session status. They are commonly created and managed using JavaScript code.

The web browsers of the past, which based their operation on the use of a single process, kept a single collection of cookies call cookie jar. With the advent of browser multi-processoil cookie jar became responsible for handling an ever-increasing number of requests.

Web specifications require JavaScript to retrieve cookies in a manner synchronous. Answer each request correctly document.cookiehas become a blocking operation.

Google technicians explain that 87% of access to cookies performed by web pages today is completely redundant, unnecessary and reduces performance. Many websites, in fact, have multiple accesses to the contents of the cookies, in rapid succession, contributing to the creation of queues of requests and slowdowns.

What is the new solution and how does it work Shared Memory Versioning

Google developers who noticed the problem in managing cookies, developed the new system Shared Memory Versioning. Each value returned after a call document.cookie, is combined with a “version” that increases monotonically. In fact, the version number gradually grows by one unit, without ever going back.

Each rendering process (renderer) stores in cache the last value read from document.cookie along with its corresponding version. The network service (network service) hosts in the shared memory the updated version of each request document.cookie.

In this way, when a renderer advance needs to retrieve the value of a cookie, it can first check whether the cached version matches the one hosted in shared memory by network service. If the versions match, the renderer can use the cached value, thus avoiding sending an inter-process query to the network service to obtain the contents of the various cookies. However, if the versions do not match, it means that the value of document.cookie has been changed, so the renderer you will have to make a request to network service to get the latest updated value.

Google explains that this approach significantly increases browser performance and improves the behavior of web pages.

A change that is already available to all Chrome users

The Mountain View company now details how the scheme works Shared Memory Versioning but it also clarifies that the new paradigm has been in place in Chrome since December 2023. In February 2024, the distribution of the same new feature to the entire user base was completed. The performance graph published in the final part of the note issued by Google highlights the performance improvement, measured on response timeswhich the “new” approach to managing cookies has allowed us to achieve.

The publication of the work on the Chromium blog suggests that, although this is not made clear and the text always refers to Chrome, Shared Memory Versioning can also become part of third-party browsers such as Edge, Opera, Vivaldi and so on.

Leave a Reply

Your email address will not be published. Required fields are marked *