Code::Blocks Forums

User forums => Help => Topic started by: Mr. Guest on April 21, 2005, 03:52:37 pm

Title: Program bloat and compile speed questions.
Post by: Mr. Guest on April 21, 2005, 03:52:37 pm
OK I just switched from Dev-C++ 4(with Mingw 2.95) to the latest CB build a few days ago and I've got a few questions.

1) With Dev-C++ my current project was 230k but now is at 710k. Is there any way to un-bloat it without a exe-compressor.

2) In Dev-C++ it took about 30-40 seconds to compile but CB has added about a minute on to that. Any way to change this?

I realize it has nothing to do with the IDE, it's all the compiler. I'm just thinking there's some options I have to turn on that Dev-C++ has enabled by default. I don't have any build options on right now, I tried optimizing but that  caused my program to crash.

I can sort of live with the bloat, but the compile time thing is making me crazy. Thanks for any replies.
Title: Program bloat and compile speed questions.
Post by: mandrav on April 21, 2005, 05:40:14 pm
Quote
1) With Dev-C++ my current project was 230k but now is at 710k. Is there any way to un-bloat it without a exe-compressor.

Try "strip your.exe". This will strip unnecessary symbols from it. You can also compress it with upx if you need.

Quote
2) In Dev-C++ it took about 30-40 seconds to compile but CB has added about a minute on to that. Any way to change this?

I don't think so... You see, gcc-3.x is slower then 2.95 and there is nothing we can do about it. Only the gcc developers could change it, although I believe there are plenty good reasons why it's slower now, like better ANSI compliance etc.
You could, though, use Code::Blocks with your old compiler, gcc-2.95 ;)

Yiannis.
Title: Program bloat and compile speed questions.
Post by: Anonymous on April 21, 2005, 08:25:07 pm
OK thanks. I finally figured out how to use strip and now it's at 390k.

Mabye I should upgrade from 64mb ram if I want it to move faster :)
Title: Program bloat and compile speed questions.
Post by: rickg22 on April 21, 2005, 09:26:06 pm
Don't forget that UPX can also compress your exe _AND_ dll's! (In fact I'm still waiting for the option to run post-build commands on the compiled executable).
Title: Program bloat and compile speed questions.
Post by: heaveny38 on May 25, 2005, 09:03:41 pm
I'm new to this forum and I am currently switching from DevCpp to code::blocks too.

I am experiencing the same problem. Except turning on exe stripping doesn't bring back the size I was getting with DevCpp. And I was using DevCpp with the same version of the compiler too.

With devcpp I was getting something around 110kbytes with stripping enabled. With Codeblocks, I am getting around 360kbytes with strpiping enabled (added -s in linker options).

What is going on?

With MingW developer studio, the exe is even smaller, same compiler, what are the hidden options, or the ones that are not in the list taht could cuase that?

Thanks.
Title: Program bloat and compile speed questions.
Post by: mandrav on May 25, 2005, 09:38:32 pm
Code
#include <iostream>

int main()
{
std::cout << "Hello world!" << std::endl;
return 0;
}

Result: 282,624 bytes

Code

#include <stdio.h>
#include <stdlib.h>

int main()
{
printf("Hello world!\n");
return 0;
}

Result: 5,632 bytes

As you can see, it really depends on the libraries used...

Yiannis.
Title: Program bloat and compile speed questions.
Post by: heaveny38 on May 25, 2005, 11:47:10 pm
Yeah, I know, but this big code size difference happens only with my code, not when only using standard libraries. It's weird.
Title: Program bloat and compile speed questions.
Post by: squizzz on May 26, 2005, 12:54:18 am
Can you post your source here?
I bet some people would enjoy playing with compiler switches... :)
Title: Program bloat and compile speed questions.
Post by: heaveny38 on May 26, 2005, 08:42:20 pm
Well, it's about 300k of source files, it'S a library that I was working on to learn more about true C++ and templates. I guess I can't post it as a source block in the forum heh ;) Is there any other way? As I plan to drop it, there's no secret in there :)

EDIT:

The thing is, even when doing nothing, the exe is huge, meaning that a lot of stuff gets inside it even when not using it. Adding code in main.cpp hardly changes the size. It's as if everything was getting linked even though it wasn't used.
Title: Program bloat and compile speed questions.
Post by: squizzz on May 26, 2005, 10:27:10 pm
Quote
The thing is, even when doing nothing, the exe is huge, meaning that a lot of stuff gets inside it even when not using it. Adding code in main.cpp hardly changes the size. It's as if everything was getting linked even though it wasn't used.

No matter what is happening, it should be possible to make it at least same size as it is in Dev-C++ (if MinGW versions are the same).

You can send it to: squizzz (at) gmail.com. I could take a look in my spare time. Anyone else? :D
Title: Program bloat and compile speed questions.
Post by: thomas on June 09, 2005, 07:06:02 pm
Hmmm...?

int main(int argc, char *argv[])
{
return 0;
}

Dev-CPP 4.9.9.2               ---> 5632 Bytes
code::blocks 1.0finalBeta    ---> 5632 bytes

Both are stripped executable sizes, compiler switches whatever the respective IDE comes with as default.
Title: Program bloat and compile speed questions.
Post by: David Perfors on June 09, 2005, 07:08:56 pm
that is probably mingw/gcc...