Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Simple optimization question

Author: Bob Durrett

Date: 07:40:37 01/09/04

Go up one level in this thread


On January 09, 2004 at 10:04:53, Daniel Clausen wrote:

>On January 09, 2004 at 09:56:26, Bob Durrett wrote:
>
>>On January 09, 2004 at 08:34:05, Tord Romstad wrote:
>>
>>>On January 09, 2004 at 08:14:05, Ricardo Gibert wrote:
>>>
>>>>If the if-test is seldom executed or the if-test is predictable, why should you
>>>>optimize it? Use a profiler to determine what "needs" optimizing. Even then,
>>>>think twice before you mangle the readability of your code.
>>>
>>>I'm quite well aware of all of this.  If you browse the archives, you will
>>>probably find that there are few programmers here who warn about premature
>>>opitimization more often than I.  :-)
>>>
>>>Have a look at this message for the most recent example:
>>>
>>>http://www.talkchess.com/forums/1/message.html?340567
>>>
>>>However, in the present case readability is not a major concern for me.
>>>One of my plans for the not very distant future is to throw away my
>>>current evaluation function entirely, and design some sort of high-level
>>>language for defining the evaluation function.  I will then write a Lisp
>>>program to transform this evaluation function to C code.  If this works
>>>as well as I hope, I will never again have to read or write a single line
>>>of C code in my evaluation function, and I am free to choose the low-level
>>>constructs which give the fastest code, without worrying about readability.
>>>
>>>I hate working in low-level languages like C, C++ and assembly language,
>>>and prefer to let a program do the dirty work of churning out the most
>>>complicated bits of the code rather than doing it all by hand.
>>>
>>>Tord
>>
>>That sounds like the proverbial ostrich with head in sand!
>>
>>Your higher language will eventually produce c code???  Then the c code could
>>have either form being discussed but you will have no control over which.  You
>>have merely hidden the problem from your own view!  If you create a "compiler"
>>which converts your higher language to c, then you will still have to tell the
>>"compiler" what form to use.  What have you gained?
>
>Abstraction.
>
>Using C is already an abstraction as well, since a CPU doesn't execute C-code
>but machinecode.
>
>Unfortunately most people hardly ever consider writing their own language for
>certain things. (it doesn't have to be a high-abstraction language, it can also
>be a moderate complicated code-generator for certain things) I think most people
>either underestimate these things or are simple not aware of it.
>
>Sargon

Well, in all fairness, I truly admire people like the guy who created the c
language and also admire people who create compilers for the new higher level
languages.  The way I see it, the "Computer Linguistics Expert" is a big knotch
above the ordinary programmer.  : )

Bob D.



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.