Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Can a Programming Language Cause Engines to be Slow?

Author: Robert Hyatt

Date: 14:16:26 11/14/02

Go up one level in this thread


On November 14, 2002 at 13:35:25, Dieter Buerssner wrote:

>On November 13, 2002 at 15:55:51, Robert Hyatt wrote:
>
>
>>You can do that in C with bit-fields as well, but it both it and ADA are
>>horribly
>>slow when you fiddle with bitfields.
>
>Can you show a small example, where bit-fields in C produce horribly slow code?
>I am aware of the fact, that much of the internal data layout of bitfields is
>implementation defined in C, so, as in many other cases too, some low level
>tricks (for example by using unions) cannot be coded portable. But the same is
>already true without using bit-fields. However, assembly output I looked at,
>seemed very reasonable. There are some pitfalls, like type int may be signed or
>unsigned int, but this can be taken care of in the code, by never using int
>alone without signed or unsigned.
>
>Regards,
>Dieter


The first place I found it was in my compressed move format.

IE I had a move defined as

struct move {
  unsigned int from:6;
  unsigned int to:6;
  unsigned int piece:3;
  unsigned int captured:3;
  unsigned int promot:3;
}

I noticed how slow it was by simply packing/unpacking directly in C using AND/OR
bitwise operations, and it sped it way up.  I tested this on two compilers of
the time,
gcc and sun's CC compiler...




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.