Users who often follow Google Chrome browser updates should know that Google has made a lot of improvements to Chrome resource usage and speed in the past few years, including tab freezes, better memory management and release, and battery optimization.
Recently, Google published a blog in which it revealed how they optimized the Chrome window, which increased the startup speed by 25.8% and reduced the number of crashes by 4.5%.
Google has previously frozen the inactive tabs of the Chrome browser to reduce CPU, GPU, and memory usage, leaving more system resources for the foreground tabs that users really need. But this method is limited to those tabs that are not placed in the foreground, minimized, or moved off the screen.
Google found in experiments that 20% of Chrome browser windows are covered by windows of other applications, or obscured in users’ daily use. Therefore, Google envisions that if these occluded windows can be treated as background tabs, the Chrome browser will have a more obvious performance improvement. Based on this assumption, Google started researching a project about three years ago that can track the occlusion status of each window in real time and reduce the priority of tags in the occluded window.
Google calls this project "Native Window Occlusion", which can obtain the position of the local non-Chrome window on the user's screen, and then combine the position of each Chrome window itself to calculate the occluded window and area.
There are two main parts to track which Chrome windows are blocked. The first part is the occlusion calculation, which includes traversing the open windows on the desktop in the order of the Z axis, and checking whether the window in front of each Chrome window completely covers it; the second part is the decision When to perform occlusion calculations.
In order to prevent blocking the UI thread and reducing Chrome's response speed when performing occlusion calculations, Google placed occlusion calculations on a separate thread and considered many possible situations:
Ignore minimized windows because they are not visible by themselves.
Mark Chrome windows on different virtual desktops as blocked.
Traverse open windows on the desktop from front to back, ignoring invisible windows, transparent windows, floating windows, invisible windows, etc.
The area of the window is subtracted from the unobstructed screen rectangle.
If the window is a Chrome window, check whether its area overlaps the unobstructed area. If not, it means that the Chrome window has been obscured by the previous window.
Continue to iterate until all Chrome windows are captured.
...
Google stated in its blog that enabling this feature brings significant performance advantages:
☞ Startup speed increased by 8.5% to 25.8%
☞ 3.1% reduction in video memory usage
☞ The overall number of frames drawn by the renderer is reduced by 20.4%
☞ 4.5% reduction in renderer crashes
☞ The first input delay is reduced by 3.0%
☞ The first content drawing and maximum content drawing speed increased by 6.7%
This feature was launched to Windows users as part of the Chrome 86 version in October 2020. Google has not yet indicated whether this feature will land on Linux or Mac Chrome browsers in the future.