libc++ clean-up

Hi

Would patches for cleaning up unnecessary #include for libc++ be accepted? In general it seems like it has followed the rather poorly designed GNU STL rather than being more strict.

A simple preprocessed hello world which only #include <iostream>

CC -E hello.cxx -std=c++11 > hello-libcxx.e.cxx

du -sh *.e.cxx
532K hello-stdcxx.e.cxx
1.3M hello-libcxx.e.cxx

The effects of this cascade into being a measurable performance difference later on in the compiler. (My numbers may not be exactly llvm upstream though - ymmv) Basically the Module size and other things are larger as a result.

Thoughts/feedback?

Yes, noticed this before. iostream pulls a significant part of libcxx:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-October/032330.html

There are real unobvious dependecies in libcxx

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-October/032349.html

I’m not sure if the #includes could be removed. Would probably require breaking up large headers into smaller ones.

Yaron

Note that libc++ contains a lot of stuff that libstdc++ does not (all of the C++14 additions, for example).

However, I’d be interested in suggestions/proposals for making the compile-time burden smaller.

— Marshall

Adding #includes to <__config>, such as <unistd.h> and <errno.h> contributes to poor compile times.

Howard

Hi

Would patches for cleaning up unnecessary #include for libc++ be accepted?
In general it seems like it has followed the rather poorly designed GNU STL
rather than being more strict.

A simple preprocessed hello world which only #include <iostream>

CC -E hello.cxx -std=c++11 > hello-libcxx.e.cxx

du -sh *.e.cxx
532K hello-stdcxx.e.cxx
1.3M hello-libcxx.e.cxx

The effects of this cascade into being a measurable performance difference
later on in the compiler. (My numbers may not be exactly llvm upstream
though - ymmv) Basically the Module size and other things are larger as a
result.

Thoughts/feedback?

The code for the two libraries is different though. How did your
measurements correct for that, so that you can so surely attribute it to
unnecessary includes, and not simply differences in implementation?

-- Sean Silva