.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Developer's Farm > General Programming
General Programming Help others and get yourself helped here!

Reply
 
Thread Tools
M$ Visual C++ 2005 Express compilation settings
Old
  (#1)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default M$ Visual C++ 2005 Express compilation settings - 12-03-2006

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 /ERRORREPORTROMPT 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?
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#2)
The Storm
Council Member / E[POD]bot developer
 
The Storm's Avatar
 
Status: Offline
Posts: 1,620
Join Date: Jul 2004
Location: Bulgaria
Default Re: M$ Visual C++ 2005 Express compilation settings - 14-03-2006

You can't have the same size when you compile with differend compilers.
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#3)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: M$ Visual C++ 2005 Express compilation settings - 15-03-2006

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%).
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#4)
jeefo
путинхуйлоебаное
 
jeefo's Avatar
 
Status: Offline
Posts: 453
Join Date: Nov 2005
Location: Saint-Petersburg
Default Re: M$ Visual C++ 2005 Express compilation settings - 15-03-2006

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.
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#5)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: M$ Visual C++ 2005 Express compilation settings - 15-03-2006

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?
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#6)
jeefo
путинхуйлоебаное
 
jeefo's Avatar
 
Status: Offline
Posts: 453
Join Date: Nov 2005
Location: Saint-Petersburg
Default Re: M$ Visual C++ 2005 Express compilation settings - 15-03-2006

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)
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#7)
Whistler
Summoner
 
Whistler's Avatar
 
Status: Offline
Posts: 1,499
Join Date: Feb 2004
Location: Mist Village
Default Re: M$ Visual C++ 2005 Express compilation settings - 16-03-2006

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
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#8)
Austin
Moderator
 
Austin's Avatar
 
Status: Offline
Posts: 403
Join Date: Nov 2003
Default Re: M$ Visual C++ 2005 Express compilation settings - 19-03-2006

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....
  
Reply With Quote
Re: M$ Visual C++ 2005 Express compilation settings
Old
  (#9)
DrEvil
Member
 
DrEvil's Avatar
 
Status: Offline
Posts: 142
Join Date: Jan 2004
Location: Los Angeles, CA
Default Re: M$ Visual C++ 2005 Express compilation settings - 20-03-2006

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.


Omni-bot AI framework
http://www.omni-bot.com

Foxbot - for Team Fortress Classic
http://www.foxbot.net


  
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com