Computer Science Canada 454 kb Hello world program!! |
| Author: | haskell [ Wed Dec 27, 2006 8:01 pm ] |
| Post subject: | 454 kb Hello world program!! |
Yeah lol... So I think I busted my compiler(fixed it by getting a fresh of GCC). It compiled my mid-sized app to 30 kb, but a hello world program to 454 kb:shock: . I think it was iostream and the STL that caused it for me. No, I don't want help, I was just wondering if anyone has experienced anything similar lol. It is pretty funny |
|
| Author: | [Gandalf] [ Wed Dec 27, 2006 8:11 pm ] |
| Post subject: | |
Yep. I've noticed a significant change in file size mostly based on what compiler you're using. For example, with GCC a terminal based hello world program might be a few hundred KB, but using VC++ the equivalent program is 5 KB and a simple GUI program is 15 KB. Never really done much exploring into it, seeing as how I have no shortage of storage space. |
|
| Author: | haskell [ Wed Dec 27, 2006 8:16 pm ] |
| Post subject: | |
Interesting. I'm looking at OpenWatcom as a replacement for GCC, just because of this retarded overhead that seems to be common. I got 40 kb for a helloworld a couple days ago. I can't wait to get my Intel C++ compiler lol -.-. |
|
| Author: | [Gandalf] [ Wed Dec 27, 2006 8:31 pm ] |
| Post subject: | |
Note that I still prefer to use GCC over Microsoft's compiler for non-GUI programs. What harm are a few extra KB going to cause? |
|
| Author: | haskell [ Wed Dec 27, 2006 8:45 pm ] |
| Post subject: | |
I prefer using a visual resource editor and GCC for GUI apps, but each to his own I suppose. Its just as easy, if not easier... If you want I can show some examples of resources in apps using GCC? And it just bugs me. I am still a low-level programmer at heart... I used to program full scale apps in MASM32 and FASM(Two assembly dialects), and program highly optimized C code in LCC. So, any extra memory usage or performance loss that I don't deem proper, I get pretty picky lol... So yeah... That few KB eats at me... Annoys me... It burns! GET IT OFF!!!!! |
|
| Author: | bugzpodder [ Thu Dec 28, 2006 10:06 pm ] |
| Post subject: | |
i built a 150-ish C++ program with STL headers... this shockingly was over 20MB with g++ 4... |
|
| Author: | md [ Thu Dec 28, 2006 10:35 pm ] |
| Post subject: | |
I have a ~2400 line app; it compiles to 812K for the client, 792K for the server and oddly 812K for both combined. If anyone wants to see the size of the relevant msvc++ executables the code is at svn://svn.nxor.org/vnet/ |
|
| Author: | neufelni [ Fri Dec 29, 2006 12:44 am ] |
| Post subject: | |
For me, Hello World compiles to 7.8Kb using gcc. |
|
| Author: | wtd [ Fri Dec 29, 2006 12:54 am ] |
| Post subject: | |
The question I would ask is whether or not you know how the STL works. |
|
| Author: | bugzpodder [ Fri Dec 29, 2006 10:52 am ] |
| Post subject: | |
yes, its a template library, so it essentially is a template, ie put your code in theirs. But 20MB by god is a large app |
|
| Author: | Mazer [ Fri Dec 29, 2006 11:07 am ] |
| Post subject: | |
Can you guys give me some tips? I must be going about this the wrong way because I'm putting "using namespace std;" in all of my source files and g++ won't give me more than 86KB. |
|
| Author: | Clayton [ Fri Dec 29, 2006 11:12 am ] |
| Post subject: | |
Has anyone recently tried to download MinGW? I've been trying to download it to my laptop, but it continually stops halfway through with the installation/downolad and it's getting very annoying. |
|
| Author: | wtd [ Fri Dec 29, 2006 11:29 am ] |
| Post subject: | |
bugzpodder wrote: yes, its a template library, so it essentially is a template, ie put your code in theirs. But 20MB by god is a large app
Every time you instantiate a template with a different set of values or types, new code gets generated. Are you telling the compiler to optimize? |
|
| Author: | bugzpodder [ Fri Dec 29, 2006 12:18 pm ] |
| Post subject: | |
no, I dont use the optimize option |
|
| Author: | wtd [ Fri Dec 29, 2006 12:20 pm ] |
| Post subject: | |
Perhaps you could post the offending source code. |
|
| Author: | md [ Fri Dec 29, 2006 2:24 pm ] |
| Post subject: | |
I would like to point out that my filesizes are perhaps a little inflated; debug info was compiled in and there were no optimization at all. I get 138K (for all) without debug, and 124K (for all) with -O3; I get 88K with -Os however. All in all I'd say that's pretty good. |
|
| Author: | haskell [ Fri Dec 29, 2006 3:05 pm ] |
| Post subject: | |
I wasn't asking for help lol. Its a HelloWorld lol... Anyways, OpenWatcom gets rid of the problem(~50kb without optimization). Plus it has(IMO) better optimization options. And yeah, it is the STL(iostream) that caused the huge .exe for it. But with OpenWatcom, it isn't an issue(although it shockingly said that I had included 1770~ lines with iostream). Which makes sense to the size of the included lines. To solve the problem with GCC, in short, use OpenWatcom(Its open-source(still) and IMO, better than GCC(though I don't think its on unix-based systems yet...). |
|
| Author: | bugzpodder [ Fri Dec 29, 2006 4:26 pm ] | ||
| Post subject: | |||
me?
|
|||