Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c,c++5,c#.

Author: Sune Fischer

Date: 09:44:28 08/14/04

Go up one level in this thread


On August 14, 2004 at 09:08:50, Tord Romstad wrote:

>On August 13, 2004 at 19:48:52, Sune Fischer wrote:
>
>>Wouldn't it be silly to develop a strong 50000 line engine and then have to
>>rewrite all of that to a different language?
>
>50000 lines of code is a lot for a chess engine, even when it's written in C.
>Gothmog
>is currently about 10000 lines, despite the fact that the code is terribly
>bloated and
>contains too much cut and paste code.  My new engine is currently contains of
>slightly
>less than 3000 lines of code, but it will probably grow a lot when I improve my
>very basic evaluation function.

Mine is slightly larger, I'd say more than 15000 probably closer 20000.

Lot's of code for debugging, communication, statistics and stuff so only a small
part is essential.

Most of that would still be needed anyway if you changed language, so it's a
huge job rewriting it and afterwards testing and debugging the new code also.

>An engine written in a higher-level language would probably be much shorter.  My
>experience with Lisp is that non-trivial programs are usually at least 5 times
>shorter
>than an equivalent C program, and I expect the same to be true for most other
>high-level languages.

I believe that just makes it even hard to convert to C/C++ later on.

>Besides, I think it is healthy to do a complete rewrite from time to time.

So getting the disease is not that bad because the cure is so healty? :)

>>When would be a good time to make this conversion, how strong should the engine
>>become?
>
>The programmer decides, of course.  There is no single "right moment" for this.

Precisely and therefore I think there is a chance it will never happen.

>Some may want to use C from the beginning, some may want to migrate
>to C some time later in the development process, and some may never want to
>do so.
>
>Of course, hybrid solutions are also possible.  You can write the first version
>of
>your engine in a high-level language, profile it, and rewrite the
>performance-critical
>parts in C or assembly language.

That's fine in theory, but I don't think you can compare profiles across
languages.
A lot of the hotspots in the highlevel language could probably be removed by a
good C-implementation.

>>
>>I thought Delphi was comparable to C in speed.
>
>Comparable, but probably slightly slower.  Just like the other languages I
>mentioned.

Hmm, I seem to recall some benchmarks where Delphi (or was it Ada?) got better
scores than C, but I guess if C is generally faster is mainly due to better
compilers.

>>I consider it time well spent if you learn the language well.
>
>It depends on what you do for a living, I guess.  If you are paid to do research
>in algebraic geometry, it isn't really time well spent.  :-)

Quite right, perhaps this also explains your preference of highlevel languages
:)

A lot of people are slaves of habit I think, if one is used to language A and
know that better than language B, then one is much more inclined to try and
write anything in A eventhough objectively B would be the best choice for the
job.

-S.



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.