GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
c++/modules Performance Win

Disable dependent ADL inside C++ header units to improve stream-in performance.

Dependent Argument-Dependent Lookup (ADL) is now disabled within C++ header units to prevent significant slowdowns in module stream-in.

This commit disables dependent Argument-Dependent Lookup (ADL) when processing C++ header units. This change directly addresses a significant performance regression, roughly doubling the stream-in time for the std module when <bits/stdc++.h> is built as a header unit. Because header units do not discard or hide entities, dependent ADL is not strictly necessary in this context and its removal restores module stream-in performance to previous levels.

In Details

The depset::hash::add_dependent_adl_entities function in module.cc is responsible for adding dependent ADL entities to the module dependency graph. This process is part of GCC's C++ module implementation to ensure correct name lookup across module boundaries. However, in the context of header units, which fully expose all entities without omission or hiding, the extensive dependency tracking introduced by dependent ADL proved to be an unnecessary performance bottleneck. By conditionally disabling this function when a header unit is being processed, the overhead associated with establishin…

For Context

C++ modules are a modern feature designed to improve compilation times and reduce the complexity of managing header files. Instead of repeatedly parsing header files, modules allow you to pre-compile and import them, speeding up your build process. Argument-Dependent Lookup (ADL) is a C++ language rule that helps the compiler find the correct function to call when the function name isn't explicitly qualified (e.g., std::sort). Dependent ADL is a more complex variant of this process that applies when template arguments are involved, and it can be computationally intensive as the compiler has to examine many potential namespaces. This change focuses on C++ "header units," which are a way to treat existing header files as modules. The issue was that performing dependent ADL inside these header units, while technically correct, was causing a significant slowdown in how quickly the compiler could load or "stream-in" the pre-compiled module data. Since header units don't hide any entities…

Filed Under: c++modulesperformanceadl