Hi Chandler,
First let me say your GoingNative 2013 talk was very interesting. There is lots of potential in improving the efficiency and reliability of C++ programming, especially with the new feature in C++ 11. One has to de-program old habits to use these features.
To the subject, I did not meaure times exactly since the effect was very noticable for a trivial test program, three times as slow!
Here are the combinations I tested:
clang + libcxx iostream = about 3 seconds
clang + libstdc++ iostream = about 1 second
clang + libc stdio.h = about 1 second
gcc + libcxx iostream = about 3 seconds
gcc + libstdc++ iostream = about 1 second
gcc + libc stdio.h = about 1 second
clang.exe is from http://llvm.org/builds/, gcc is MingW-builds 4.8.1 32 bit.
For clang + libcxx the command was:
clang main.cpp -nostdinc -I…/libcxx -I…/mingw-4.8.1 -target i686-pc-mingw32 -Wno-deprecated-register -Wno-ignored-attributes libc++.dll.a libc++abi.dll.a -o main.exe
For clang + libstdc++ the command was:
clang main.cpp -nostdinc -I…/libstdc -I…/libstdc/i686-w64-mingw32 -I…/mingw-4.8.1 -target i686-pc-mingw32 -Wno-deprecated-register -Wno-ignored-attributes libstdc++.dll.a -o main.exe
For gcc + libstdc++ the command was:
gcc main.cpp -lstdc++
For gcc + libcxx the command was:
gcc main.cpp -std=c++11 -nostdinc -I…/libcxx -I…/libstdc/i686-w64-mingw32 -I…/mingw-4.8.1 -lstdc++ libc++.dll.a libc++abi.dll.a
These results were repeatable when running mutiple times.
The iostream code is:
#include
int main() {
std::cout<<“hello cout\n”;
return 0;
}
The stdio.h code is:
#include <stdio.h>
int main() {
printf(“hello printf\n”);
return 0;
}
The headers used with gcc are the defaults.
The headers used for clang are libcxx or libstdc++ for C++ and MingW 4.8.1 for the C library.
So when compiling small modules, libcxx slows down compilation considerably compared with including libstdc++.
Yaron