Computer Chess Club Archives


Search

Terms

Messages

Subject: Optimizing in Visual C++ 6.0

Author: Vincent Vega

Date: 22:07:47 02/12/00


Something for the engine strength freaks :-)

Visual C++ 6 usually generates faster code than VC++ 5 but to make full use of
its power one should know about a couple new features.  One is a new keyword
__forceinline.  It increases chances that a function will be inlined, overriding
compiler's judgement.  However, in my last project we found that the compiler
will still sometimes not inline where it could and copy and paste was needed to
get the maximum speed.  Of course one should know that inlining could make
program slower due to worse cache consistency, so actual timing should always be
done.  Tracing through the generated code to see where the function calls are is
the only way to know.  A lot of Visual C++ newbies don’t know that it is
possible to have an optimized release build with debug information on –
something that is necessary here.

Another one is a dangerous keyword __assume.  It gives the compiler a hint that
the expression in true.  We found some uses for it with deferencing pointers but
the gains were quite minimal.

I found the included profiler to be workable but you don't want to have to
switch it on and off if it takes over an hour to rebuild, so you'll need to make
a separate project settings for it.  Some of the results I got seemed suspect
and I wonder if the slow down was evenly distributed.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.