Original Post
🔒 Locked
Execution File Size
Advertisement
I'm not familiar with release mode ( and have no idea even after a google search) , my programming platform is freeBSD. Language is C++, and compiler is gcc to be more specific.
for example, I added about 5 lines and the code went up by 200k, LOL
and i didn't even use a new library.
for example, I added about 5 lines and the code went up by 200k, LOL
and i didn't even use a new library.
well with visual C++ it's easy to choose release mode and have all debug info stripped from executable, resulting in much smaller file. I'm not exactly sure of the parameters in GCC, but I don't believe it has to do with compression, thats more of an optomization thing. If you're using Dev-C++, you can go into
project options -> compiler -> linker
and set Strip Executable to yes (it seems to be "No" by default), I would bet that would solve your problem. I don't know the actual gcc command line switch for this however.
project options -> compiler -> linker
and set Strip Executable to yes (it seems to be "No" by default), I would bet that would solve your problem. I don't know the actual gcc command line switch for this however.
Compression? The 'O' option controls optimization, not compression. "-O0" means no optimization and the code is usually pretty large. It is normally used only for debugging.
Performance-wise, "-O3" is the best optimization level, but the code might be bigger than "-O2". If you are concerned about the size of the executable more than its performance, then "-Os" is the one you want. It will try to generate the smallest executable at the expense of performance.
There are also linker options to strip unused code and data.
Why are you concerned about the size of the executable?
Performance-wise, "-O3" is the best optimization level, but the code might be bigger than "-O2". If you are concerned about the size of the executable more than its performance, then "-Os" is the one you want. It will try to generate the smallest executable at the expense of performance.
There are also linker options to strip unused code and data.
Why are you concerned about the size of the executable?
Quote:
Original post by Tradone
I'm not so concerned, but just don't want my files to get any larger. IDK. So, even though the file size is big, it doesn't necessarily mean that it will run slower right?
True and false at the same time. In theory, it should not change anything - and most of the time, it won't shnage anything. THere might be a problem when code locality comes into play, because having the processor flushing its code cache migh take time - and if he does this too often (by jumping all around), the performance may decrease.
Remeber that using templates might make your program size grow (as well as using global variables BTW) but in the end it don't really matter - unless you have less than 4 MB on your PC, and I doubt this is the case [smile].
HTH,
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement