[cfe-dev] yet another question about modules

mobi phil mobi at mobiphil.com
Thu Jan 22 17:45:46 PST 2015


Hi,

sorry if it is annoying, yet another email about the topic, but I am
working hard to understand that whatabouts of the modules. Promise hereby
to give further the wisdom once gathered ;)

Tried to joggle with modules again today, to see if it can improve the
build times of a given project. Before going to that project I just tried
to build simple C++ files with few template instantiations. The first
conclusion is that using the modules, build times increase instead of
decreasing.

I took a very trivial use case.

#include <map>
#include <string>
using namespace std;
typedef map<string, string> map0;
typedef map<map0, map0> map1;
......
.......
//typedef map<map"i-1", map"i-1"> map"i";

int main () {

map0 m0;
map0 n0;
m0=n0;
map1 m1;
map1 n1;
m1=n1;
map2 m2;
map2 n2;
m2=n2;
......
......
.....
}

for "one level" instantiation, without modules, clang seems to be a little
faster than gcc, but for i > 3. With modules compilation is much longer.

Can anybody please help to understand if modules really help to speed up
compilation and give an idea of how?

Though unrelated an even more discouraging result is that for i > 4 clang
takes an eternity. For i=9, I stopped the process after 13 minutes
I have 16GB on my machine (8 cores AMD), and the compiler does not seem to
use more than 2GB of memory (from /proc/.../status: VmPeak:  2033548 kB).

for i=6 I get

g++: 0,05s system 99% cpu 0,375 total
clang++ (both from dev branch and 3.5) 11,81s user 0,06s system 99% cpu
11,908 total
this means factor 30? Is clang scaling so badly?
Please do not feel offended about this report.

Anyway, the reason of this email is about understanding how much modules
can help. Let's say that I have the situation with this (i=6) and assuming
-std=c++11 can I assume that modules will bring compilation times to
something reasonable?


thanks a lot for your help,
mobi phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150123/3ddb6282/attachment.html>


More information about the cfe-dev mailing list