For Bryan Hoffmann - but all feedback welcome

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

For Bryan Hoffmann - but all feedback welcome

Postby Jack Hyams » 19 Oct 2005, 12:08

I became interested in code optimisation when I read a post that Bryan had written commenting on the amount of time that optimisation of code could take and that good compilers were expensive.

My questions are based on my understanding that

a) All compilers make 2 passes, one to convert high level code into assembler and the second to convert assembler into machine code.

b)The conversion to assembler is the inefficient step because the compiler can't see the wood for the trees ? ie because the compiler does not know what the code is trying to do, it cannot produce efficient assembler.


1)Are a) and b) correct?
2)Is optimisation therefore based on optimising the code after the first compiler pass?
3)Can you predict by looking at the code the amount of time optimisation will take ie does well written code produce significantly better assembler than poorly written code?
4)Is it easier to optimise C than Delfi?
5)If some languages require less optimisation than others, what is the order of these languages?
6)I found that Bryan's optimisation of Fruit 2.1 produced an 8.5% speed increase over the unoptimised code. What speed advantage would well written assembler have over well written and compiled C?
7)What speed advantage would a top compiler give over a standard compiler such as Gcc?
8)Please suggest names and prices of top compilers.



Jack
Jack Hyams
 
Posts: 4
Joined: 04 Jul 2005, 11:25

Re: For Bryan Hoffmann - but all feedback welcome

Postby Dann Corbit » 19 Oct 2005, 15:19

This is the wrong way to look at optimization altogether.

The compiler does better than you will at making the code turn into fast assembly.

If you want to optimize, you are far better off using a better algorithm or improving the existing one.

There are lots of sites on code optimization. Many of them are obsolete, because the tricks that used to make things go faster are done automatically by the compiler now.

For example, this is totally obsolete:
http://www.abarnett.demon.co.uk/tutorial.html

Here are some worth reading:
http://www.azillionmonkeys.com/qed/optimize.html
http://g.oswego.edu/dl/oosd/ch25.html
http://www.codeproject.com/tips/optimizationenemy.asp
http://www.prism.uvsq.fr/~cedb/local_copies/lee.html

Bentley, Knuth, Sedgewick, Weiss
Know and love them. Someday, they may save your life.
Dann Corbit
 

Re: For Bryan Hoffmann - but all feedback welcome

Postby Jack Hyams » 19 Oct 2005, 18:58

Thank you for the links.
Jack
Jack Hyams
 
Posts: 4
Joined: 04 Jul 2005, 11:25

Re: For Bryan Hoffmann - but all feedback welcome

Postby Bryan Hofmann » 20 Oct 2005, 02:10

First I want to say, I am not a programmer and will never claim to be nor want to be. What I am able to do is study code that is created by others and make the compiler create a executable the way I see is the fastest. Today's compilers are good at making choices for the most part, but they are general in nature and side on the safe side when doing so. All I do is tell the compiler what should be inlined and what should be a fastcall vs a standard calling conventions. I have found that in these areas I am better at making the choices then the compiler. The reason it takes a great deal of time is due to the fact that alot of trial and error is involved. Some would say it is not worht the extra effort to do this. For me, it is just something I like to do to got the most out of the code.

This may not answer your questions but I would like to leave you with this thought. I once spent an entire weekend of compile test recompile test just to get the end result of another 10K NPS. If this is the sort of thing that interest you then I would recommend you take the route I did and play with different compilers and test different aspects.

BTW I have a Universal MSDN subscription which is on the expensive side.


Bryan
Bryan Hofmann
 
Posts: 98
Joined: 02 Oct 2004, 20:26
Location: USA

Re: For Bryan Hoffmann - but all feedback welcome

Postby Joachim Rang » 20 Oct 2005, 10:00

Bryan, can you please check your mail?

Joachim
Joachim Rang
 
Posts: 69
Joined: 26 Sep 2004, 22:00

Compiler Optimisation

Postby Jack Hyams » 20 Oct 2005, 17:01

Thank you Bryan. The info. from you and Dann gives me a feeling for the procedure. I don't think this one is going to the top of my list of things to do.
Jack
Jack Hyams
 
Posts: 4
Joined: 04 Jul 2005, 11:25

Re: For Bryan Hoffmann - but all feedback welcome

Postby Bryan Hofmann » 20 Oct 2005, 22:43

Joachim Rang wrote:Bryan, can you please check your mail?

Joachim


Checked and did not see anything. I sent you a note.


Bryan
Bryan Hofmann
 
Posts: 98
Joined: 02 Oct 2004, 20:26
Location: USA

Re: For Bryan Hoffmann - but all feedback welcome

Postby Joachim Rang » 21 Oct 2005, 08:51

Bryan Hofmann wrote:
Joachim Rang wrote:Bryan, can you please check your mail?

Joachim


Checked and did not see anything. I sent you a note.


Bryan


Strange. If you still don't get emails from me please check your privat messages on this board.

Joachim
Joachim Rang
 
Posts: 69
Joined: 26 Sep 2004, 22:00


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 39 guests