Programming and Scripting :: C++ compiling really slow



when I compile hello world in C++ it takes like 12 seconds to compile
Code Sample

#include <iostream>
int main(){
std::cout << "Hello World!" << std::endl;
}

but when I program hello world in C it finishes in under a second
Code Sample

#include <stdio.h>
int main(){
printf("Hello World!\n");
return 0;
}



Why does the C++ version take so long to compile? Any ways to speed it up?
this is using the gcc1.dsl package

Maybe enable DMA for your hard drive. You can boot with:

dsl dma

to try this.

there's no hard drive and I don't see how hard drive speed will change this as it's less than 1KB of a file.
C++ is just a lot more complicated.

The compiler has to do a lot of work processing the files included directly/indirectly by iostream:

#include <istream>
#include <ostream>
#include <ios>
#include <iosfwd>
#include <exception>
#include <bits/char_traits.h>
#include <cstdio>                   <---- even the stdio C header file
#include <bits/localefwd.h>
#include <bits/ios_base.h>
#include <streambuf>
#include <bits/basic_ios.h>

Linking the C std functions is a piece of cake. stdio includes only one or two basic files.


original here.