Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: C++ compiling really slow< Next Oldest | Next Newest >
eedok Offline





Group: Members
Posts: 7
Joined: Jan. 2005
Posted: Mar. 01 2006,06:59 QUOTE

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
Back to top
Profile PM 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: Mar. 01 2006,07:10 QUOTE

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

dsl dma

to try this.
Back to top
Profile PM 
eedok Offline





Group: Members
Posts: 7
Joined: Jan. 2005
Posted: Mar. 02 2006,05:27 QUOTE

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.
Back to top
Profile PM 
_pathos Offline





Group: Members
Posts: 91
Joined: Aug. 2005
Posted: Mar. 02 2006,07:00 QUOTE

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.
Back to top
Profile PM 
3 replies since Mar. 01 2006,06:59 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: C++ compiling really slow

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code