Microsoft optimizes chrome.exe to pin to taskbar to reduce CPU usage

A patch submitted by Microsoft for Chromium optimizes performance by checking that the browser is fixed to the taskbar. According to Microsoft’s description in the patch, they found that Chrome uses a piece of code to detect whether the currently running chrome.exe is pinned to the taskbar at 45s after launch. Every call to this code (chrome!) UtilWinImpl:: IsPinnedToTaskbar) generates a highER CPU consumption (the CPU time of 300ms and 1s wall time).

Microsoft optimizes chrome.exe to pin to taskbar to reduce CPU usage

This process consists mainly of:

Enumerate all shortcuts that are pinned to the taskbar folder

Check if they are shortcuts to the currently running exe

Enumerate all shortcut-related shell verbs

Check if verb is in the “unpin” state (i.e. is fixed to the taskbar)

The above procedure uses a separate process to check, and checking the shell verbs causes the shell usage to be loaded, running third-party code, which can lead to increased CPU usage.

Microsoft has optimized this process so that instead of enumerating verbs on shortcuts, they use other fixed state checks in the code base instead. The code that enumerates the shell verbs is removed and the code is run in the browser process instead of using a separate process because third-party code is no longer loaded.

This change ultimately reduces the CPU usage of checking the browser’s status in the taskbar accordingly. This consumption may not be obvious to most configurations, but Microsoft’s Eric Lawrence believes that fixing minor issues can ultimately improve browser performance.

Microsoft optimizes chrome.exe to pin to taskbar to reduce CPU usage