Computer Chess Club Archives


Search

Terms

Messages

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

Author: Tord Romstad

Date: 15:48:07 11/15/02

Go up one level in this thread


On November 13, 2002 at 13:35:51, Robert Hyatt wrote:

>(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.

Not necessarily.  You can write very low-level code in Lisp.  The language
actually has a wider range of bit-twiddling functions than C.  If you avoid
dynamic data structures, use type declarations where appropriate, use
compiler macros and inline functions, and compile your code with maximum
optimization, modern Lisp compilers generate excellent machine code.  I
also find it much easier to use inline assembly language in Lisp than in C.

I am fairly sure that _I_ wrote two similar chess programs, one in Lisp and
the other in C, the Lisp version would be at least as fast as the C version.
The main reason for this is that I am a professional Lisp programmer and
just an amateur C programmer; I am sure that expert C programmers could
squeeze some more speed out of a C program than a Lisp program.  However,
the difference is nowhere near as big as most people seem to believe.  My
guesstimate is that a highly optimized C chess program would run at most 50%
faster than a similarly optimized Lisp program.

One day I hope to find the time to do a more or less direct translation of
tscp (or some similarly simple program) into Lisp, simply as a
proof-of-concept.

Tord



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.