Computer Chess Club Archives


Search

Terms

Messages

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

Author: Robert Hyatt

Date: 10:35:51 11/13/02

Go up one level in this thread


On November 13, 2002 at 11:55:45, Bob Durrett wrote:

>
>[Prompted by Windows vs Linux threads.]
>
>Some people do their chess programming in Visual Basic, and it would be no
>surprise if their chess programs were slow when compared to those programmed in
>C or C++.
>
>The use of FORTRAN as a programming language, for creating chess engines, seems
>to have been abandoned a long time ago.  Presumably for good reasons.

Not for speed, however.  FORTRAN compilers are just as good as C compilers,
which
is why Cray Blitz was originally written in FORTRAN...


>
>Someone once said here, at CCC, that choice of programming language is mostly a
>matter of personal preference:  "If someone learns C before anything else, they
>will prefer programming in C simply because they feel more comfortable in C."

That is true...


>
>And yet, with the pressure to produce the highest rated chess engine, it would
>seem that programmers would select "the very best" language [and the very best
>computer] if they were able to use that language.


The language is pretty well immaterial.  What most of us want are:

(1) portability.  C fits the bill here as does C++, but also FORTRAN and other
languages.

(2) speed.  Again C and any other good compiled language is just fine.
Interpreted
languages are not so good for obvious reasons.

(3) programming language features.  loops.  block if-then-else structures, good
access
to native hardware data units, etc.  Unfortunately, the more complex the
language, the
worse the optimizer, which is why C is quite popular.  Very simple programming
language,
fairly close to assembler-level stuff, makes it fast/efficient.  More abstract
languages (PL/1,
ADA, and off into the _really_ abstract stuff like prolog, snobol, lisp and so
forth) tend to
produce slower executables.

>
>If it is true that "the Fritz people" [F.M.?] use assembly language to avoid
>"optimizers," then maybe that is the best language of all, other than machine
>language.  [Of course, no one would use maching language! : ) ]

Supposedly true.  I did this for Cray Blitz.  You would do this if speed is your
primary
goal.  You avoid this if portability is important at all.

>
>A person who spends all day at work using a particular computer will wish to
>program their chess engines in the language they use at work.  That is
>understandable, especially if they wish to produce a chess engine to use on
>their "work computer" during breaks at work.  But isn't there a penalty for
>doing that?  In other words, doesn't that mean that the chess engine may not be
>as fast as it could have been otherwise?
>

Depends on two things:

(1) the compiler/optimizer.

(2) the programmer.  You can write slow code using the most efficient language
on the planet.  A good programmer can write code that is reasonably fast even
using
a less efficient programming language.






>Since choice of language pretty much dictates the compilers, then it seems that
>one would chose languages which do not require inferior compilers.  Maybe Linux
>is a poor choice of language for just that reason?


Linux isn't a "language".  It is an operating system.  It has a very good
compiler in gcc.
It can use an even better compiler that is free from Intel and that is very
close to the
windows MSVC compiler.  It also has commercial compiler options from places such
as the Portland Compiler Group...




>
>Bob D.



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.