Hi,

On Mon, 23 Oct 2017, Richard Biener wrote:

> I guess so. But we have to make gdb happy as well. It really depends how 
> much each TU grows with the extra (unneeded) include grows in C++11 and 
> C++04 mode.

The c++ headers unconditionally included from system.h, with:

% echo '#include <$name>' | g++-7 -E -x c++ - | wc -l
new:      3564
cstring:   533
utility:  3623
memory:  28066

compile time:
% echo -e '#include <$name>\nint i;' | time g++-7 -c -x c++ -
new:     0:00.06elapsed, 17060maxresident, 0major+3709minor
cstring: 0:00.03elapsed, 13524maxresident, 0major+3075minor
utility: 0:00.05elapsed, 16952maxresident, 0major+3776minor
memory:  0:00.25elapsed, 40356maxresident, 0major+9764minor

Hence, <memory> is not cheap at all, including it unconditionally from 
system.h when it isn't actually used by many things doesn't seem a good 
idea.


Ciao,
Michael.

Reply via email to