Computer Chess Club Archives


Search

Terms

Messages

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

Author: Sune Fischer

Date: 13:54:30 08/12/04

Go up one level in this thread


On August 12, 2004 at 15:42:35, Russell Reagan wrote:

>On August 12, 2004 at 15:07:51, Sune Fischer wrote:
>
>>I know what you mean of course, but speed really is a factor in computer chess.
>>It's not the most important factor, but not something to be ignored either.
>
>>I'm not sure I see the point of writing an engine in a slow language, why
>>handicap yourself from the beginning?
>>Do you not want to write the best engine you can?
>
>Here is something to think about. You start writing a chess program in C or C++.
>I start writing a chess program in C#. I have mine up and running three times
>faster than you do. Let's say it takes me one month (just for discussion) to get
>my engine playing legal chess. That means that by the time you have your program
>playing legal chess (just legal chess, not good chess), I will have been working
>on search and evaluation for two months. Let's say your program runs two to four
>times as fast as mine. Now we continue developing for another month or two, and
>we have a match between our programs. After six months of development, which
>program do you think will win the match? I think it would either be close, or
>the C# engine would be the favorite.

True, but 6 months is not an interesting horizon, it takes years and most of it
is testing testing testing.

I guess I program on average 5-10 minues a day on frenzee, the rest is simply
testing. Change an evaluation term - test, try a new extension - test...

>Okay, what about two years after we started? Five years? Ten years? Does the
>rule of getting three times more work done still apply then? I think at some
>point it will have diminishing returns and the slower C programmer will catch up
>and then have an advantage in execution speed.

Exactly.
You'll be out of the start box faster, but I'll reach the finish line first.

> But maybe I am wrong about that.
>In the short term, at least, the C# programmer will have a very big advantage
>and the C/C++ programmer will be struggling to play catch up.
>
>Think of it another way. If Shredder was two to four times slower, it would
>still be a huge favorite against almost any of the hundreds of engines out
>there. You could count on one hand the number of engines that would have a
>significant advantage over it. Fritz, Junior, and maybe a couple of others. So I
>think speed is overrated unless you are at the top where things are already very
>close. Then it can become a more significant factor, such as going from #3 in
>the world to #1.

It's also psycological, at least for me. I'd simply hate to know that my engine
was running at half the nps just because I used a slow language. It would take
the fun away to play with that big a handicap, every time it lost I'd be
thinking "if only I had written it in C..".

Perhaps others might feel the fun is taken away if they have to write in C :)

One possiblity could be to develop two engines, one optimized in C and one for
quickly testing things in your preferred language.

Then only implement what works in the optimized C version.

>Basically what this tells me is that there are a lot of other factors that are
>more important than speed.

More important than what?
Go three times faster and you've earned another ply of search depth.
Depth is great, it has no ill side effects contrary to most pruning schemes.

Let A be a three times faster version of B.
Let B have a much better opening book than A, try a selfplay match and see if
speed is not more important than good opening books.

> At some point, when you have taken care of a lot of
>the other important factors, improving the speed will give a significant boost.
>In other words, making Crafty go four times faster will mean more than making
>TSCP go four times faster. There are a lot of other things that would benfit
>TSCP more than faster execution.

Premature optimizations is a different matter, but if the language is natively
slow (doing bounds checking etc..) it's simply a wrong choice for a chess
program.
YMMV

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