Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Why is assembly more effecient than C?

Author: James Robertson

Date: 15:00:26 09/26/98

Go up one level in this thread


On September 26, 1998 at 17:50:46, John Coffey wrote:

>On September 26, 1998 at 17:45:12, James Robertson wrote:
>
>>On September 26, 1998 at 17:41:04, John Coffey wrote:
>>
>>>On September 26, 1998 at 17:28:56, Bruce Moreland wrote:
>>>
>>>>
>>>>On September 26, 1998 at 17:21:58, James Robertson wrote:
>>>>
>>>>>What is a reasonable number of NPS for a program to search if it has an average
>>>>>sized evaluation procedure? I.E. what does Crafty get? Chessmaster? Comet? My
>>>>>program started out searching a very nice number of nodes per second, but as I
>>>>>added stuff that number decreased dramatically from about 600,000 to 160,000. By
>>>>>the time I finish the evaluation function (which is currently like 20 lines),
>>>>>I'm afraid it will be down to like 5,000 NPS on my P233! At what point should I
>>>>>get worried?
>>>>
>>>>When it starts to play badly.
>>>>
>>>>How did you achieve 600K nps on a normal machine?  Are you counting nodes the
>>>>way most of the rest of us are?  The way most of us do it is that a node is a
>>>>call to "search" or "quies", regardless of what happens after the call is made
>>>>(a node that cuts off via the hash table is still counted).
>>>>
>>>>bruce
>>>
>>>I think that a person could easily write a program that would do 1M nodes per
>>>second (i.e throw out hashing, null moves, move ordering etc.), but it would be
>>>pretty dumb, because it would examining all sorts of branches of the tree that
>>>it would not need to examine.
>>>
>>>John Coffey
>>
>>Yes, that was when my program had nothing but alpha-beta. Also, most of the
>>program is written in Assembly which increased my NPS over the C++ version by
>>>300%.
>>
>>James
>
>Why is assembly so much more efficient than C?   I thought that C code was
>suppose to be pretty well optimized.  I work in the video game field
>and we gave up using assembly a couple of years ago in favor of C.  (Granted
>we have faster video game machines these days.)  Anyhow, both a C program
>and an Assembly program would be making about the same number of memory
>accesses, and it would seem to me that is where the real bottle-neck is.
>The only difference would be that an assembly program might have better
>access to registers?
>
>John Coffey

The compiler generates very efficient code; but there are a lot of things you
can do in assembly that aren't avaliable in C++. Also, in assembly you think
about programming differently; I saw things I could do to improve performance I
never thought about in the C++ enviroment. Lastly, 90% of my assembly changes
were in 1 function the compiler had a terrible time optimizing; I reduced the
compiler's code from 27 lines to 10. :)



This page took 0.01 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.