Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Assembly in VC6.0 – an (bad) experience!

Author: Tony Werten

Date: 08:07:34 03/15/01

Go up one level in this thread


On March 15, 2001 at 00:18:44, Pham Minh Tri wrote:

>Hi all,
>
>In MS DOS environment, I have written some pieces of code in assembly to speed
>up program and I could double speed by that way. However, when I moved my code
>into Windows and VC6.0 compiler, that method of speedup did not work. I have
>tried several times and measured that the program with some assembly pieces of
>code could be slightly slower than one without them (pure C++, option
>optimization: maximize speed). An annoying result, isn’t it? At end I gave up
>with some conclusions as following:
>
>1) My experience of writing and optimisation assembly is 16 bit one, not good
>enough for 32 bit with many new instructions. However, I little doubt about this
>conclusion because I designed all data structures suitable for 16 bit (I did not
>use Bitboard structure), and many 16-bit instructions are not slower than 32 bit
>(and some others may be quicker).

It only shows that 16-bit assembly is different from 32-bit. Different timings,
instructions and most of all architecture.

You have to change your structures to 32 bit as well.

>
>2) MS VC6.0 compiler may do the best for optimisation of speed. It means we
>could do very little more only.

They wish they could write such an compiler. A compiler is meant for general
use, in assembly you can write speciffic for your needs.

>
>3) Many functions of chess, which we may convert into assembly code, are not
>complicated, so that a good compiler as VC6.0 could make optimisation as good as
>an expert. People could do better than program in more complicated and graphic
>applications.

My personall opinion is that a chessprogram is quite complicated. It's the only
thing I think is still a challenge after 2 years.

>
>4) Because of all above, if I insist, I could get a speedup of 3-5% after a huge
>effort. It is much more expensive than speedup by other way.

Use a profiler to find your most called function. This is a good candidate for
conversion. But don't start with this to fast. Experimenting with an
assemlyfunction is a lot harder than in C or Pascal.

cheers,

Tony

>
>Just my thought and experience. Do you get better results or other experiences?
>Pham



This page took 0.02 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.