.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Programming (http://forums.bots-united.com/forumdisplay.php?f=25)
-   -   M$ Visual C++ 2005 Express compilation settings (http://forums.bots-united.com/showthread.php?t=5031)

KWo 12-03-2006 19:44

M$ Visual C++ 2005 Express compilation settings
 
WHat are optimal settings for M$ VC++2005 Express?
When I compile podbot mm sources I'm getting the file about 335 KB (almost similar settings with mingw I'm getting the file about 280KB).
For general C/C++ compliation I have such command line:

/O2 /I "../hlsdk\multiplayer\dlls" /I "../hlsdk\multiplayer\engine" /I "../hlsdk\multiplayer\common" /I "../metamod-p\metamod" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "PODBOT_MM_EXPORTS" /D "_VC80_UPGRADE=0x0710" /D "_WINDLL" /D "_MBCS" /FD /EHsc /MT /Fo"Release\\" /Fd"Release\vc80.pdb" /W3 /nologo /c /Wp64 /TP /errorReport:prompt /D_CRT_SECURE_NO_DEPRECATE

For linking I have such command line:

/OUT:"Release/podbot_mm.dll" /INCREMENTAL:NO /NOLOGO /DLL /MANIFEST:NO /MAP:"pbmm.map" /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /IMPLIB:"Release/podbot_mm.lib" /MACHINE:X86 /ERRORREPORT:PROMPT kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib

What I have to change/remove to get smaller, but still optimized (with /O2) file after compilation?

The Storm 14-03-2006 22:17

Re: M$ Visual C++ 2005 Express compilation settings
 
You can't have the same size when you compile with differend compilers.

KWo 15-03-2006 08:42

Re: M$ Visual C++ 2005 Express compilation settings
 
OK - But I always tought M$ gives the most optimized windows compilation - so I' msurprised by the size of the dll given by M$ C++ 2005 Express. M$ - 330KB, mingw - 280KB - something here has to be incorrect then - it shouldn't be so big difference (about 18%).0_o

jeefo 15-03-2006 12:34

Re: M$ Visual C++ 2005 Express compilation settings
 
Because when you using /MT (M$VC) switch, the program linking against STATIC version of LIBCMT.LIB, thats give output binary to be more huge. While mingw links your program against non-static library (msvcrt.dll). M$VC can also links program against non-static library, but uses not msvcrt.dll, but msvcr80.dll, so output binary can only work on machine that have M$VC 8.0 runtime libraries installed.

KWo 15-03-2006 21:33

Re: M$ Visual C++ 2005 Express compilation settings
 
Yup - just tryied - with /MD instead /MT I got the file about 241KB now. :)
So - is there a way to force M$ VC++ 2005 Express to use msvcrt.dll instead msvcr80.dll?

jeefo 15-03-2006 22:22

Re: M$ Visual C++ 2005 Express compilation settings
 
Why you need a small-size dll? you can simply compress it for example with UPX... Filesize don't affects application speed (i suppose). Actually it's possible to force M$VC80 to use old dll, but you may have encouter many problems with it (tested myself), such as "Abnormal program termination" in win98, and you will need to hack c2.dll (to use ftol instead of ftol2).

If you want to reduce size of DLL a little bit, try to use /ML switch (Single-threaded), it's give you about 20KB out.

(PS. sorry for my poor english)

Whistler 16-03-2006 04:19

Re: M$ Visual C++ 2005 Express compilation settings
 
the "best optimized" compiler maybe the Intel compiler, but I didn't see any difference from gcc when I tried it on a game which is laggy on my old computer.

and you can't really rely on any of those so-called "state of the art optimizations" too much to speed up your programs. A good program will always beat a bad one, as long as the compiler is not crap ;)

Austin 19-03-2006 01:38

Re: M$ Visual C++ 2005 Express compilation settings
 
A smaller size exe/dll means SLOWER run time speeds!
Optmized for execution speed makes the binary LARGER since more things are placed inline and duplicated for fast execution....

DrEvil 20-03-2006 21:53

Re: M$ Visual C++ 2005 Express compilation settings
 
Austin, that's the biggest load of bull I've read in a long time. Smaller size often(not always) means faster execution. Better instruction cache means faster running code, and when its smaller it can be faster than a compile that is optimized for speed. Rarely have I seen significant differences in the two, so don't expect miracles in either case. Too much inlining can bloat the size of the code, resulting in slower code, there is a point of diminishing returns, so it's misleading to imply that smaller code means slower code. That's wrong.


All times are GMT +2. The time now is 11:45.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.