Hi fellow chromium-devs,
If you don't write code for ash-chrome, or don't collect vlog in feedback reports, you can stop reading now.
tl;dr
Long version:
When vlog code was ported to chromium, we stripped the caching in VLOG_IS_ON to reduce binary size (
code). Each VLOG() statement includes:
VLOG_IS_ON ->
::logging::GetVlogLevel ->
GetVlogLevelHelper ->
VlogInfo::GetVlogLevel runs a little loop to do logging::MatchVlogPattern for every vmodule pattern supplied.
This became a problem over time as more and more VLOGs were added and more and more vmodule patterns were added as it resulted in non-trivial cpu cost. Olivier has also created an excellent
investigation document on the problem, the impact, the findings, and possible solutions. The problem is currently tracked in an old
crbug/489441.
CL:3334864 addresses the problem by compiling out all VLOGs out of source code unless they have ENABLE_VLOG_LEVEL=x macro defined. We pay no cost and enjoy a binary size reduction for VLOGs that are not enabled with the macro. For the enable VLOGs, we pay little cpu cost to compare 2 int log levels.
Regards
Xiyuan