Recently, Chrome developer David Bienvenu in his new series of blog posts titled "The Fast and the Curious" "revealed" in detail some of the recent improvements Google has made to the Chrome browser. Among them, it includes the Native Window Occlusion (Native Window Occlusion) project created by Google during 3 years of research, which can increase the browser startup speed by 25%.
It is reported that this blog post explains the work done by Google to reduce resource consumption of invisible tabs and windows in Chrome. Google said that this operation increased Chrome's startup speed by 25.8% and reduced the number of crashes by 4.5%.
The "Secret" blog post also pointed out that Google has been researching how to better determine which Chrome windows and tabs are visible to users for many years, so that system resources can be allocated appropriately.
We know that tabs that are not in focus (also known as "background tabs") can reduce the priority of CPU and GPU resources, but are occluded windows (that is, windows that are open but are completely or partially covered by other windows) So what?
Regarding this issue, Bienvenu wrote in a blog post that Google has learned that "20% of Chrome windows are completely covered by other windows, that is, completely obscured. If these obscured windows are treated as background labels, then our assumption is Will see significant performance advantages."
As a result, Google began research on the "Native Window Occlusion" project, which will allow Google to understand the occlusion status of any open Chrome window. Of course, to understand this, they must also know the location of the non-Chrome browser window, but this is not the information that the Windows operating system can provide.
Taking into account factors such as multi-monitor settings and virtual desktops, the above problems become more difficult.
In order to solve this problem, Google proposed the "occlusion calculation (occlusion calculation)" program, which can run in a separate thread of the UI, first calculate the user's total visible area, and then subtract all words from the visible area of the virtual desktop as " "Occluded" Chrome windows, check each open window from front to back, and finally subtract any open windows from the total.
If it is a Chrome window, it will check whether its area overlaps with an unobstructed area; if it is a non-Chrome window, it means that the Chrome window is completely covered by the previous window. At this point, the software will continue to run calculations until all Chrome windows are marked as occluded, which means that the rest must be visible to the user. After having this information, publish a task to the scheduler to improve the visibility of the browser window.
Google improves Chrome performance by evaluating hidden windows
With the above solution, Google posed an interesting question, "How often do we hope to run the calculation?"
For this question, Bienvenu also answered in the blog post. He said that continuous operation will reduce performance, so it must be selective operation.
Fortunately, the Windows system allows applications to track events such as moving and adjusting the size of the open window, so Chrome will connect to these notifications. When the user moves or resizes the window, Chrome will issue an alert and decide whether to perform a new occlusion calculation. .
Bienvenu's blog post also pointed out that the calculation is run on a 16ms timer, which corresponds to an interval of 60 frames per second (FPS).
It is understood that Google launched this program for all Chrome users as early as October 2020. Now that some time has passed, Google has also shared the results of the above "experiments". These include:
- Startup speed increased by 8.5% to 25.8%
- GPU memory usage decreased by 3.1%
- Reduced renderer frames for overall drawing by 20.4%
- The number of clients experiencing renderer crashes decreased by 4.5%
- The first input delay increased by 3.0%
- The first content drawing and maximum content drawing speed increased by 6.7%
The success of the above is also because Google accurately realizes when the Chrome window is blocked or completely blocked by other windows. If you are also using the Chrome browser, you can open it now and feel the speed of the window startup!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。